android studio新建项目后出现bug finished with non-zero exit value 1
2017-02-18 11:22
337 查看
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
解决办法:
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
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引用
> 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 Plugin aaptOptions { 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'
相关文章推荐
- 解决android studio中出现的finished with non-zero exit value 1或者finished with non-zero exit value 2的问题
- [置顶] Android Studio Eclipse运行时出现 finished with non-zero exit value 2 错误解决方法
- Android Studio 运行时出现 finished with non-zero exit value 2
- Android Studio 运行时出现 finished with non-zero exit value 2 错误分析
- Android Studio 运行时出现 finished with non-zero exit value 2
- 关于Android studio项目sdk1\build-tools\23.0.1\zipalign.exe'' finished with non-zero exit value 1问题
- Android Studio 运行时出现 finished with non-zero exit value 2 终极解决方案
- Android Studio 运行时出现 finished with non-zero exit value 2 错误分析
- Android Studio编译程序出现finished with non-zero exit value 2错误
- Android Studio 运行时出现 finished with non-zero exit value 2 错误分析
- android studio项目运行失败 finished with non-zero exit value 1 的解决办法
- android-studio中运行项目出现 java.exe'' finished with non-zero exit value 2错误
- 关于android studio引入环信sdk3.0 easeui 出现finished with non-zero exit value 2
- Android Studio导入jar包,报错 finished with non-zero exit value 2
- andoid studio 运行项目 finished with non-zero exit value 1 错误
- 关于解决android studio各种疑难杂症系列----finished with non-zero exit value 1
- AS出现 Process 'command 'F:\java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1问题
- Android Studio编译大工程报错:java.exe'' finished with non-zero exit value 1
- android studio错误解决finished with non-zero exit value 1 【javax/xml/namespace/QName.class】
- Android_AndroidStudio运行时出现 finished with non-zero exit value 2