android studio 程序错误

一.错误类型:

com.android.tools.fd.runtime.BootstrapApplication cannot be cast to

成功修改方式

File --> Settings--> Build,Execution,Deployment -->Instant Run ---> 去掉勾选  开头为"Enable instant run.........."

mac下:Android studio --> Preferences...--> Build,Execution,Deployment -->Instant Run---> 去掉勾选  开头为"Enable instant run......"

 

 

二. Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE],程序运行没有问题,安装时总出现安装不上错误。

成功修改方式

试试修改一下manifest文件 :添加 一句:   android:installLocation="preferExternal"  ,可以大大减少程序在系统中占用的时间

[html]view plaincopy

  1. < manifest   xmlns:android = "http://schemas.android.com/apk/res/android"   
  2.      package = "com.app.flashlight"   
  3.      android:installLocation = "preferExternal"   
  4.      android:versionCode = "1"   
  5.      android:versionName = "1.0"   >

即 修改下安装位置  就OK了. 

 android:installLocation可以设置为"auto"、"internalOnly"、"preferExternal"三个值中的任何一个.

  auto:程序可能被安装在外部存储介质上(例如:SD Card),但是默认会被安装到手机内存中.当手机内存为空时,程序将被安装到外部存储介质上.当程序安装到手机上后,用户      可以决定把程序放在外部储介质还是内存中.

  internalOnly:默认值.当设置为该值时,程序只能被安装在内存中,如果内存为空,则程序将不能成功安装.

  preferExternal:将程序安装在外部存储介质上,但是系统不保证程序一定会被安装到外部存储介质上.当外部存储介质不可以或空时,程序将被安装到内存中.程序使用了for      ward-locking机制时也将被安装到内存中,因为外部存储不支持此机制.程序安装后,用户可以自由切换程序应该在外部还是内部存储介质上.

注意:当程序使用了Google Play的Copy Protection特性时,只能安装到内存中.

 

三.当android studio 导入eclipse项目时出现以下报错错误

错误: 非法字符: '\ufeff'

错误: 需要class, interface或enum

解决方案:mac下下载sublime text2该版本免费3就收费了, 将该文件用sublime打开后选择file->Save With Encoding->UTF-8,相关解决方案:http://blog.it985.com/14193.html

     windows下下载Notepad++(免费) , 将该文件用Notepad++打开选择格式转换编码,相关解决方案:http://my.oschina.net/u/1455799/blog/339139

 

四、android studio打包签名出错

Error:Execution failed for task ‘:app:proguardRelease’. 
Java.io.IOException: The same input jar [E:\myproject\app\libs\XX.jar] is specified twice. 

在 2016/10/14日最新的studio版本中修改 文件下面的 proguard-project.txt

-libraryjars libs/xx.jar 前加#屏蔽

下方添加 -keep class com.baidu.** { *; } 其中 com.baidu  是您的jar包下的文件包名

参看:http://blog.csdn.net/i374711088/article/details/46786189

 

五读取不到工程下的build下的main.jar文件错误

Error:Execution failed for task ':GenericApp:packageDebug'.
> java.io.IOException: Failed to read zip file '/Users/minyuchun/androidwork/projectstudio/WeishanLake/GenericApp/build/intermediates/transforms/mergeJavaRes/debug/jars/2/1f/main.jar'.

 查看一下gradle编译版本

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'//本人在版本2.3.1的时候编译出错,改为2.2.3 程序编译成功可运行
    }

 

posted @ 2016-07-14 10:25  化身程序猿  阅读(697)  评论(0编辑  收藏  举报