1.dexDebug ExecException finished with non-zero exit value 2
需要在gradle中配置下面的代码,原因是引用了多个libraries文件




defaultConfig {
        multiDexEnabled true
}




2.Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/app/BackStackState$1.class




原因:在所添加的jar包或aar包中也引用了support-V4,与工程中引用的相冲突
Ctrl+N --> 在搜索框中输入BackStackState --> 查找到所有引用该类的类,这些类即为引起冲突的类
去掉本工程中gradle中用于引用有冲突的包的代码或者将冲突的代码从jar包或aar包中移除,确保一个module中只引用了一份相同的第三方包




3.project sturcture和Project Structure 无论是按快捷键或者是从files中打开都不显示




event log中报:IllegalArgumentException:Multiple entries with same key: Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23) and Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23)




解决办法:先看一下系统配置的SDK的位置和Android Studio所用的路径是否一致,如果不一致重新配置系统的SDK路径或者是重新修改Android Studio的SDK路径
通过SDK Manager删除掉google API23
如果解决不了,卸载android studio -->重新安装 ,还有问题点击File --> Invalidate Cashes/Restart --> Invalidate and Restart,解决不了继续通过SDK Manager删除掉google API23




4.如果依赖工程和主工程中有同名同类型的资源文件,需要修改依赖工程中的资源名称编译时才不会报错,如果依赖工程中的这个资源文件是整个工程都不需要用到的,可以直接删掉;




5..Logcat的console中,显示”no debuggable applications”的问题:Tools→Android→Enable ADB Integration;


6.移除所有support-v4的依赖
configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
}


6.14.Execution failed for task ':xxx:validateRelealseSigning'.
> Keystore file E:\code\xxxr\xxx_keystore not found for signing config 'relealse'.




build.gradle目录中的配置内容为
 //签名
    signingConfigs {




        relealse {
            storeFile file("../xxx_keystore")




            storePassword "xxx"
            keyAlias "xxx"
            keyPassword "xxx"
        }
    }








../xxx_keystore指的是该工程所在的工作空间目录,在具体工程目录的上一级,如果文件位置放错会导致找不到文件


7.出现下面的异常时




Error:Execution failed for task ':xxx:transformClassesAndResourcesWithProguardForRelease'.
> java.io.FileNotFoundException: E:\testimportintostudio\xxx\proguard.cfg (系统找不到指定的文件。)


从eclipse中导出的gradle工程,会报这个错误
一种方式可以将eclipse中的proguard.cfg这个文件拷贝到所提示的目录中
另一种方式可以将Module中的build.gradle中的混淆编译代码改为

//加载默认混淆配置文件
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'


改为
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




8.导包时报错This fragment should provide a default constructor,
忽略错误
lintOptions { 
  abortOnError false 
  checkReleaseBuilds false 





9.从eclipse中导出的工程在android studio中乱码
下载超级批量转码转换 --> 将所要转码的文件所在的文件夹拖到工具中 -- >不管原来是什么编码,将编码方式复选框中选中你所要转换的编码格式-->点击开始

注:转码之前将代码复制一份,因为偶尔有个别文件在转码过程中出现异常,代码只剩下一半的问题,需将原来的代码拷贝过去



10.E:\MyApplication3\app\build\intermediates\res\merged\apus\debug\values-v23\values-v23.xml
Error:(4) Error retrieving parent for item: No resource found that matches the given name 


'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 


'android:Widget.Material.Button.Colored'.


编译时所需要的资源文件所需要的SDK版本是23,将编译的版本改为23就可以了  compileSdkVersion 23


11.

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.

解决办法:在android层级添加jackOptions选项

android {  ...  compileSdkVersion 23  buildToolsVersion "24rc2"  defaultConfig {  ...    jackOptions {      enabled true    }  }  compileOptions {    sourceCompatibility JavaVersion.VERSION_1_8    targetCompatibility JavaVersion.VERSION_1_8  }} 







12.Error:A problem occurred configuring project ':app'.
> Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8.

解决办法:在android层级添加jackOptions选项

android {  ...  compileSdkVersion 23  buildToolsVersion "24rc2"  defaultConfig {  ...    jackOptions {      enabled true    }  }  compileOptions {    sourceCompatibility JavaVersion.VERSION_1_8    targetCompatibility JavaVersion.VERSION_1_8  }} 


更多相关文章

  1. android sqlite 批量插入数据优化代码
  2. android http通过post上传文件和提交参数(通过拼装协议)
  3. Android 几种加密解密的方法(仅代码)
  4. EACCES (permission denied)解决办法 android 文件读写
  5. 【Android】用于打开各种文件的intent
  6. 《第一行代码--Android》 Git时间
  7. android 文件的读取与写入以及TextView的滚动

随机推荐

  1. Android(安卓)Studio简单的登录界面
  2. Android(安卓)Custom Views and XML attr
  3. drawlayout
  4. Android(安卓)SDK R14 发布
  5. Android之Activity--Loaders
  6. Android(安卓)Media Scanner Mechanism A
  7. 在android中玩转wcf
  8. android中操纵sqlite数据库
  9. Android(安卓)studio maven pom.xml
  10. Android: ADB网络调试