android错误总结

1、Caused by: android.view.InflateException: Binary XML file line #60: Error inflating class <unknown>

文件布局解析错误:xml布局中存在错误,XML file line #60显示是在xml中60行

解决方式:找到错误指示解析的布局,修改对应行

2、Caused by: libcore.io.ErrnoException: open failed: EROFS (Read-only file system)

文件读写错误:可能原因:1)文件读写权限没有加  

<span style="font-size:14px;"> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /></span>

2)文件路径错误,检查是否存在此路径

3、导工程进入studio时报错,Error:Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details

解决办法,在项目目录下,app的build文件中加入(加入android标签内)

defaultConfig {
    multiDexEnabled true
}

4、 Error Loading Project: Cannot load 3 facets Details...

plugins插件加载错误:我所使用的办法,settings---->plugins然后选中

由于我的是报此项没有加载上因此选中

然后右上方会出现

点击Reset然后应用(apply),OK重新启动就好了

5、adb已停止工作(不停弹出对话框)

真机问题,手机重启或取掉手机报错就不会出现了

6、非法字符错误(在导入别的工程时候出现的错误)

编码问题,将utf-8格式选择为utf-8无BOM编码格式(将所报错的文件都改掉),这里我所用的工具是notepad++修改之后就能正常运行了

7、安装studio SDK更新文件时

-=Warning !=-
A folder failed to be renamed or moved.On Windows this typically means
that  a program is using that folder (for example Windows Explorer or your anti-virus software.)
Please momentarily deactivate your anti-virus software
Please also close any running,programs that may be accessing the directory
'G:\software\android-sdk-windows\tools'.
When ready,press Yes to try again.

 解决方法有两种:

第一种方法(貌似是从国外的网站上找来):

1, 复制 tools目录 为一个新的目录 tools-copy ,此时在android-sdk-windows 目录下有两个目录 tools 和 tools-copy
2, 在tools-copy目录运行 android.bat ,这样就可以正常 update all 了
3, 之后,关闭 sdk, 
4, 在 android-sdk-windows 目录运行 SDK Setup.exe

第二种方法:

 1, 进入sdk的temp文件夹,下载好后会有一个tools_r10-windows.zip(版本号可能会不一样,如r09)
 2, 解压此文件,如解压到tools_r10-windows目录
 3, 进入tools_r10-windows文件夹,将tools_r1006-windows里的文件复制
 4, 覆盖掉sdk根目录的tools文件夹中的文件

8、Error:Execution failed for task ':app:processDebugManifest'. > 
Manifest merger failed with multiple errors, see logs

文件冲突(重复问题)  此处为Manifest重文件冲突
导入module(vitamio)冲突,我的问题是,两个中的label和icon调用不一致导致,

修改方式,改为一致就好了

9、Error:CreateProcess error=216, 该版本的 %1 与您运行的 Windows 版本不兼容。(在更新Android studio版本时出现)

更新版本后导入以前的版本,出现问题:

首先:更改studio中SDK路径(一般情况下是下载的studio的路径),把这个路径更改为自己sdk的路径

然后在根据提示更新不同版本的gradle应该就能运行了

10、在使用webview加载url的时候出现错误: "TypeError: Cannot read property 'Token' of null

我这儿的解决方式:可能是缓存问题,需要清除缓存(设置属性的时候加上下面这段代码就好了)

webView.clearCache(true);  //清除缓存


11、Error:Execution failed for task ':app:prepareComAndroidSupportAnimatedVectorDrawable2421Library'.
> Could not initialize class com.android.ide.common.util.ReadWriteProcessLock

解决:
将gradle版本改为(2.4以后出现的问题)
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'

12、Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>

解决:
更改gradle中的版本为自己当前新建项目使用的版本。检查sdk版本号,编译工具版本号等是否正确

13、Error:Failed to complete Gradle execution.


Cause:
远程主机强迫关闭了一个现有的连接。


解决:
gradle版本异常,修改正确(studio可用的,gradle中的版本号可能不能用,或者是那个版本有为题导致不能用,可以删除掉不能用的版本)的版本

14、Error:Failed to find CMake.
<a href="install.cmake">Install CMake and sync project</a>

解决:
下载安装cmake(1、sdk中有的话就直接下载,2,、没有的话就下载cmake安装到sdk目录下)(靠,tmd只有64bit的studio才支持下载,32bit的不行)

15、java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=29148, uid=10106 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()

解决:
权限没有申请,一般错误发生在6.0以上,首先动态申请一下权限就好了

16、Error:Execution failed for task ':app:mockableAndroidJar'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: 
com.android.builder.utils.FileCache$FileCreatorException: java.lang.NullPointerException


解决方法:不用管,直接编译就能通过

17、继承AppCompatActivity  findviewbyid出问题
(1)Ambiguous method call. Both findViewById(int)in AppCompatActivity and findViewById(int) in Activity match
(2)'findViewById(int)' in 'android.support.v7.app.AppCompatActivity' clashes with 'findViewById(int)' in 'android.app.Activity'; both methods have same erasure, yet neither overrides the other



解决方法:

  1、AppCompatActivity转换为Activity 

  2、getDelegate().findViewById(R.id.text);

  3、(TextView) getWindow().findViewById(R.id.text);
  4、由于sdk版本引起的,修改版本(将26改为25及以下就好了),对应修改v7包版本

18、fragment中嵌套fragment出现页面叠加、错乱

解决办法:只需要将打开内层fragment的fragmentManager从getActivity().getSupportFragmentManager()换成getChildFragmentManager()即可。

19、java.io.FileNotFoundException: desktop.ini

造成原因:win10系统,将jar包放在桌面目录使用命令解压jar –xvf xx.jar

解决:上网查找原因重新放在其他目录,我的是重新放在D盘文件夹下重新执行就好了

20、aidl编译报错 

1、refusing to generate code from aidl file defining parcelable

解决:aidl序列化的对象不能以"I"开头  例如:InfoBean,首字母改了就好了

2、couldn't find import for class com.xxxx

解决:Android.mk加上参数   

LOCAL_SRC_FILES += $(call all-Iaidl-files-under, aidl)

LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/aidl

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值