Android studio 编译项目遇到的一些问题

2018-05-24 11:48:27 +08:00
 rongchangpig

Android 开发初尝试,尝试编译遇到问题

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Message{kind=ERROR, text=Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'., sources=[C:\Users\admin.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\1d8531ccbcfb5f99866244a0b7edccc6\res\values-v23\values-v23.xml:4:5-135], original message=, tool name=Optional.of(AAPT)}

Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Message{kind=ERROR, text=Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'., sources=[C:\Users\admin.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\1d8531ccbcfb5f99866244a0b7edccc6\res\values-v23\values-v23.xml:34:5-105], original message=, tool name=Optional.of(AAPT)}

Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\admin\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\Users\admin\AppData\Local\Android\Sdk\platforms\android-22\android.jar -M \?\E:\HistogramTest\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S E:\HistogramTest\app\build\intermediates\res\merged\debug -m -J \?\E:\HistogramTest\app\build\generated\source\r\debug -F E:\HistogramTest\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.example.asus.histogramtest -0 apk --output-text-symbols \?\E:\HistogramTest\app\build\intermediates\symbols\debug --no-version-vectors}

代码贴上:

package com.example.asus.histogramtest;

import android.app.Activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewDebug; import android.widget.Button;

import com.example.asus.histogramtest.DiyView.HistogramView; import com.example.asus.histogramtest.bean.HistogramData;

import java.util.ArrayList;

public class MainActivity extends Activity {

private ArrayList<HistogramData> histogramDatas;   //数据
private HistogramView histogramView;    //直方图 View

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

   // histogramView.setVisibility(View.INVISIBLE);
    histogramDatas = new ArrayList<>();
    histogramDatas.add(new HistogramData(6, "6"));
    histogramDatas.add(new HistogramData(16, "16"));
    histogramDatas.add(new HistogramData(5.5f, "5.5"));
    histogramDatas.add(new HistogramData(1.4f, "1.4"));
    histogramDatas.add(new HistogramData(1.015f, "1.015"));
    histogramDatas.add(new HistogramData(80, "80"));
    histogramDatas.add(new HistogramData(1.0f, "1.0"));
    histogramDatas.add(new HistogramData(33, "33"));
    histogramDatas.add(new HistogramData(66, "66"));
    histogramDatas.add(new HistogramData(4.0f, "4.0"));
    histogramDatas.add(new HistogramData(125, "125"));

    histogramView = (HistogramView) findViewById(R.id.h);
  //  histogramView.setData(histogramDatas);

    //Button v=findViewById(R.id.btn);
   // v.setVisibility(View.INVISIBLE);

    findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
          //histogramView.setVisibility(View.VISIBLE);
          histogramView.setData(histogramDatas);
          // v.setVisibility(View.INVISIBLE);
    }
  });

}

}

8309 次点击
所在节点    Android
3 条回复
littleylv
2018-05-24 11:57:48 +08:00
KNOX
2018-05-24 12:13:39 +08:00
repository 有没有 google?
cs923
2018-05-24 12:36:15 +08:00
遇到这种错误直接复制去 stackoverflow 搜索,90%都能找到答案
ps:用 AS 总会遇到很多奇奇怪怪的问题,做好心理准备

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/457387

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX