(1)编译时发生

Error:(25, 0) Gradle DSL method not found: 'compile()'Possible causes:
  • The project 'AP' may be using a version of Gradle that does not contain the method.Gradle settings
  • The build file may be missing a Gradle plugin.Apply Gradle plugin


解决方法:

1、在最外层的Gradle中,删除如下的语句

dependencies {    compile files('libs/xUtils-2.6.14.jar')}


(2)编译时发生

Error:(25, 0) Gradle DSL method not found: 'android()'Possible causes:
  • The project 'AP' may be using a version of Gradle that does not contain the method.Gradle settings
  • The build file may be missing a Gradle plugin.Apply Gradle plugin


解决方法:

1、在最外层的Gradle中,删除如下的语句

   
android {    compileSdkVersion 23    buildToolsVersion '23.0.2'}


(3)编译时发生

Error:(1, 0) Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by using the command line flag -Dcom.android.build.gradle.overridePathCheck=true, or adding the line com.android.build.gradle.overridePathCheck=true' to gradle.properties file in the project directory.Open File


解决方法:

1、你的项目中存在中文命名,将项目中对应的中文命名改为英文即可


(4)编译时发生

Error:Execution failed for task ':app:mergeDebugResources'.> D:\workspace5\Boke\app\src\main\res\drawable\custom_Animation_progress_bar.xml: Error: 'A' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore


解决方法:

1、你的项目中res\drawable下存在大写字母,将项目中对应的大写字母改为小写字母即可


(5)在Aidl文件进行编译时发生

Error:Execution failed for task ':app:compileDebugAidl'.> java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Eclipse\android-studio-sdk\android-sdk-windows\build-tools\23.0.2\aidl.exe'' finished with non-zero exit value 1


解决方法:

1、项目的编译版本和编译工具的版本不一致,右键项目 open Moudle Setting -> app -> 修改Compile Sdk Version 和Build Tools Version 版本一致

2、可能是你的复制进来的Aidl文件的包名没有修改成当前的包名


(6)在复制权限内容,进行编译时发生

Error:Execution failed for task ':yuyin:processDebugResources'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Eclipse\android-studio-sdk\android-sdk-windows\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

解决方法:

1、就是xml 可能出现无法识别的资源文件错误, 就是资源文件 里面出错了

2、有时候在uses-permission中多了个空格也会报这个错误


(7)run程序时发生

Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled.


解决方法:

1、勾选中下图选项即可

Android开发错误——Android Studio中遇到过的错误问题与解决方案汇总_第1张图片

(8)在配置NDK后编译时发生

Error:Execution failed for task ':app:compileDebugNdk'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Eclipse\android-studio-sdk\android-sdk-windows\ndk-bundle\ndk-build.cmd'' finished with non-zero exit value 2


解决方法:

1、编译NDK时最好不要使用SDKManager里下载的ndk-bundle,否则会报这些错误

2、官网下载NDK开发包,r9、r10系列,然后替换掉久的ndk就可以了


(9)在Android Studio->run的时候发生

Unable to create Debug Bridge: Unable to start adb server: error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048)could not read ok from ADB Server* failed to start daemon *error: cannot connect to daemon'E:\Eclipse\android-studio-sdk\android-sdk-windows\platform-tools\adb.exe,start-server' failed -- run manually if necessary


解决方法:

1、网上的方案,亲测不是这个问题

根据提示查看adb的端口号5037被谁占用,通过 netstat -aon|findstr “5037” 找出相应的pid号,再通过任务管理器找到相应pid号的进程,然后将其结束,最后重启adb

2、将原本选择的默认adb换成我们自己的sdk里面的adb,亲测成功了

Android开发错误——Android Studio中遇到过的错误问题与解决方案汇总_第2张图片


(10)创建了两个Module,其中一个Module依赖另一个Module而导致了出现该问题,如果在Android Studio中,有ModuleA和ModuleB,我们希望ModuleA依赖ModuleB,运行时候可能会出现该问题

Error:Dependency Boke:zXingProj:unspecified on project app3 resolves to an APK archive which is not supported as a compilation dependency. File: D:\workspace5\Boke\zXingProj\build\outputs\apk\zXingProj-release-unsigned.apk


解决方法:

1、查看被依赖的ModuleB的build.gradle,里面可以看到

apply plugin: 'com.android.application'  
将这一句改为即可
apply plugin: 'com.android.library'  
接着会出现另一个错误
Error:Library projects cannot set applicationId. applicationId is set to 'com.dtr.zxing' in default config.

解决方法:

1、需要将builde.gradle — android — defaultConfig中的applicationId删除


(11)这个问题是我在修改Bmob的最新jar包的时候发生的错误,从3.4.6换到3.5.0时,编译出错

Error:Execution failed for task ':app:transformClassesWithDexForRelease'. > com.android.build.api.tr


解决方案:

1、jar包冲突(finished with non-zero exit value 2) 
主要表现为编译后出现 finished with non-zero exit value 2错误,原因是jar包冲突,导致的原因可能是在dependencies中使用compile files()导入一次jar包,然后有其它jar的引入方式使用compile’com.xxx’方式,正好又引用了这个jar包,所以导致了重复引用jar包的冲突。最常见的是support-v4包的重复引用

(12)当在gradle导入第三方依赖(sweetalert)之后,编译出错

Error:Execution failed for task ':qq:processDebugManifest'.> Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:45:9-43is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher).Suggestion: add 'tools:replace="android:icon"' to  element at AndroidManifest.xml:42:5-122:19 to override.


解决方案:

1、由于导入的第三方依赖也使用我们application的icon值的属性,具体修改步骤如下图,加上下面圈起来的语句

Android开发错误——Android Studio中遇到过的错误问题与解决方案汇总_第3张图片


(13)Git Push 提交到Github上发生错误

$ git push origin masterTo https://github.com/AndroidHensen/NewsTemplate.git ! [rejected]        master -> master (fetch first)error: failed to push some refs to 'https://github.com/AndroidHensen/NewsTemplate.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.


解决方案:

1、出现的主要原因是,本地没有update到最新版本的项目(git上有README.md文件没下载下来)

2、先进行代码合并,git pull --rebase origin master,再进行代码提交,git push -f origin master


(14)升级完Android Studio2.3后,打包release出现的错误

Error:Execution failed for task ':qq:lintVitalRelease'.> Lint found fatal errors while assembling a release target.To proceed, either fix the issues identified by lint, or modify your build script as follows:...android {    lintOptions {        checkReleaseBuilds false        // Or, if you prefer, you can continue to check for errors in release builds,        // but continue the build even when errors are found:        abortOnError false    }}...


解决方法:

在app的build.gradle中添加如下代码,重新Generate Signed APK即可

android{    lintOptions {        checkReleaseBuilds false        abortOnError false    }}





更多相关文章

  1. Android 记录一个智障错误
  2. library project 和android项目
  3. Mac下发布Unity3d中Android平台下出现“android (invokation fai
  4. android错误分析集锦
  5. android开发文档中的一个小错误
  6. android studio打开react-native的android工程项目时预编译失败
  7. Android实时监控项目第一篇:项目分析及AVD模拟效果图
  8. Android常见错误处理
  9. 个人对android中项目命名规则的整理

随机推荐

  1. android之ImageSwitcher 图片查看
  2. listView采用vprogressDIalog加载数据
  3. 屏幕亮屏、熄屏监听代码
  4. ViewModel + SavedState
  5. Android(安卓)利用广播接收器启动服务
  6. Android--Notification
  7. Android(安卓)网络状态操作
  8. Android与Javascript交互示例(三)
  9. Holo Dark TabWidget style for Holo Lig
  10. 图形处理