`

Android studio报错解决

 
阅读更多

Error:Execution failed for task ':clientmchatandroid:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt
    File1: F:\project\NettyApplication\clientmchatandroid\libs\httpmime-4.1.1.jar
    File2: F:\project\NettyApplication\clientmchatandroid\libs\fastjson-1.1.47.android.jar

 

build.gradle  android下添加

packagingOptions {

    exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/io.netty.versions.properties'
exclude 'META-INF/INDEX.LIST'
}

Error:(1, 0) Your project path contains non-ASCII characters. This will most likely cause the build 
中文路径问题

 文件编码报错:http://www.2cto.com/kf/201505/397774.html

网上很多解答的都是在对应的module下的build.gradle里加入下面的配置

tasks.withType(Compile) {  
    options.encoding = "UTF-8"  
}  

但是这个配置在gradle2.0以前是可以生效的,在gradle2.0以后就不能生效了,原因是

Compile已经被重命名为JavaCompile

所以在gradle2.0以后需要添加的配置如下

tasks.withType(JavaCompile) {  
    options.encoding = "UTF-8"  
}  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics