AndroidStudio工具开发中遇到的一些错误汇总



AndroidStudio工具开发中遇到的一些错误汇总。

开发中遇到的错误(持续更新)

AS版本3.0

1、

 Error:Execution failed for task :app:processDebugAndroidTestResources.
 No slave process to process jobs, aborting
  • 1
  • 2

clean和rebuild都没有成功后,直接点击 File>Invalidate Caches/Restart后编译通过

2、

 android.content.res.Resources$NotFoundException: String resource ID #0x0
  • 1

在给TextView的setText(Int int)方法中的int指的是R.string.xxx,不能赋值其它int值

3、 apk安装出现闪退

 java.lang.RuntimeException: Unable to instantiate application
  • 1

在build.gradle文件中将gradle版本安装提示修改后重新编译得到解决
这里写图片描述


4、

Warning:Conflict with dependency ‘com.android.support:multidex’ in
project ‘:app’. Resolved versions for app (1.0.2) and test app (1.0.1)
differ. See http://g.co/androidstudio/app-test-app-conflict for
details.Error Execution failed for
taskapp:prepareDebugAndroidTestDependencies Dependency Error. See
console for details.

在里一个项目中将build.gradle文件中依赖的包,都根据AS提示将版本改成最新的之后,
没有将project的build.gradle中的gradle版本安装提示换成新的,构建是报了此错误,
将gradle版本修改后问题解决

5、

Error:Tag attribute name has invalid character ’ ‘.
Error:Tag attribute name has invalid character ’ ‘.
Error:org.gradle.process.internal.ExecException: Process ‘command
‘E:\Android\sdk\build-tools\26.0.2\aapt.exe” finished with non-zero
exit value 1 Error:Execution failed for task
‘:backend01:processDebugResources’.
Failed to execute aapt

这个错误是因为在AndroidManifest.xml中category的值有一个空格,将空格去除就好了

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_28486273/article/details/78849506
文章标签: android错误

简介

当我们平常运行AS编译器,发生如下错误

Error:Execution failed for task ‘:app:preDebugAndroidTestBuild’.
Conflict with dependency ‘com.android.support:support-annotations’ in project ‘:app’. Resolved versions for app (22.1.0) and test app (25.4.0) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

发生这类型的错误,是当我们修改了.build中的compileSdkVersion,产生所依赖的dependency与当前版本不一致导致的。

解决

build->Rebuid-project