android studio新建项目后出现bug finished with non-zero exit value 1

来源:互联网 发布:软件教育 编辑:程序博客网 时间:2024/05/22 11:34

1、Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_25\bin\java.exe'' finished with non-zero exit value 1

解决办法是

Reference:http://stackoverflow.com/questions/32889059/android-studio-1-4-and-vector-image/32889565#32889565


2.Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/commons-io/commons-io/pom.properties
    File1: E:\Users\Alarm\app\build\intermediates\exploded-aar\com.microsoft.projectoxford\vision\0.5.0\jars\libs\commons-io-2.4.jar
    File2: E:\Users\Alarm\app\build\intermediates\exploded-aar\com.microsoft.projectoxford\emotion\1.0.0\jars\libs\commons-io-2.4.jar

解决办法:

packagingOptions {        exclude 'META-INF/maven/commons-io/commons-io/pom.xml'        exclude 'META-INF/maven/commons-io/commons-io/pom.properties'        exclude 'META-INF/LICENSE.txt'        exclude 'META-INF/NOTICE.txt'    }
Reference:http://blog.csdn.net/pipisorry/article/details/42965435

http://stackoverflow.com/questions/20827885/android-studio-0-4-duplicate-files-copied-in-apk-meta-inf-license-txt

http://blog.csdn.net/liuweiballack/article/details/47314101


3.

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mouse.qq/com.mouse.qq.MainActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for vectorDrawableCompat

解决办法:

reference:http://stackoverflow.com/questions/38869556/toolbar-illegalstateexception-configure-your-build-for-vectordrawablecompat

    generatedDensities = []}// This is handled for you by the 2.0+ Gradle PluginaaptOptions {    additionalParameters "--no-version-vectors"}


4.cannot resolve constructor  I ntent

解决办法:

这是因为这是Intent语句是在内部类中(inner class)(监听器类是匿名内部类,一种特殊的内部类),这时如果想用 this 来引用 MyActivity 是实现不了的,这个错误的用法等同于:
Intent( OnClickListener Listener , Class class )
第一个参数是OnClickListener类,而不是Context类,所以是错误的。

要想修正报错,正确引用Myactivity ,就必须将:
Intent intent = new Intent(this , SecondActivity.class);
改为:
Intent intent = new Intent( MyActivity.this , SecondActivity.class);


Reference:http://www.dabu.info/android-cannot-resolve-constructor-intent.html


5.在Android studio中使用httpClient 需要在build.gradle引用

useLibrary 'org.apache.http.legacy'




0 0
原创粉丝点击