`
knight_black_bob
  • 浏览: 824587 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

android as gradle 使用过称中 错误处理

阅读更多

 

 

1.出现以下错误



 在 gradle 中添加

 configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'
    }

 

 2.出现 com.android.ide.common.process.ProcessException错误

 

 这个问题的出现是在将eclipse项目导入到Android Studio中,由(.9.png)图片造成的,现在的解决方法是将其换成png图片

该问题出现原因 是 你引用了 盗来的 .9.png 非正规渠道的美工图片

 

 

 

 

 

3. Error:(1, 1) 错误: 非法字符: '\ufeff'

没有看见 明显 乱码错误等

文件 内部 编码格式 ,重新 新建该类,并把内容 复制进去 ,即可解决 

 

 4. 一下 错误

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
	File1: I:\cache\ai-w\IteyeBlog\app\libs\httpclient-4.3.5.jar
	File2: I:\cache\ai-w\IteyeBlog\app\libs\httpcore-4.3.2.jar
	File3: I:\cache\ai-w\IteyeBlog\app\libs\httpmime-4.3.5.jar
	File4: I:\cache\ai-w\IteyeBlog\app\libs\jackson-all-1.6.0.jar

 

解决方法

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

 

 5.错误 包重复   Multiple

 

Error:indicate that it is *not* an inner class.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/slf4j/impl/AndroidLoggerFactory;
Information:BUILD FAILED
Information:Total time: 9.049 secs
Information:89 errors
Information:0 warnings
Information:See complete output in console

 

 

取出多余重复报,一般在 gradle 中配置两个包没有问题,但在lib 中添加了并在gradle 中存在就会报改错误

 

 

 

 6.以下错误 

Error:Execution failed for task ':app:transformClassesWithDexForBAIDUDebug'.
> com.android.build.api.transform.TransformException: 
com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: 
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

 解决

defaultConfig { 
   ... 
multiDexEnabled true 
... 
}


com.android.support:multidex:1.0.0

 

 7. multidex NoClassDefFoundError 问题



 

public class MyApplication extends  Application {
 
    public static MyApplication myApplication; 
    
    
    public static MyApplication newInstance() {
        return myApplication;
    }
    @Override
    public void onCreate() {
        super.onCreate();
        myApplication = this;
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}




android {
    compileSdkVersion Integer.parseInt(COMPILE_SDK_VERSION)
    buildToolsVersion BUILD_TOOLS_VERSION
    defaultConfig {
        applicationId "com.curiousby.baoyou.cn.iteyeblog"
        minSdkVersion SAMPLE_MIN_SDK_VERSION
        targetSdkVersion SAMPLE_TARGET_SDK_VERSION
        versionCode 3
        versionName "3.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

}




 compile 'com.android.support:multidex:1.0.1'

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信捐助,加入it技术扣扣群),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

 

  • 大小: 48.3 KB
  • 大小: 44.6 KB
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics