Android studio error resolution

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

 

Add under 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
Chinese path problem

 File encoding error: http://www.2cto.com/kf/201505/397774.html

Many answers on the Internet are to add the following configuration to the build.gradle under the corresponding module

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

However, this configuration can take effect before gradle2.0, but cannot take effect after gradle2.0, the reason is that

Compile has been renamed to JavaCompile

So the configuration that needs to be added after gradle2.0 is as follows

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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326689264&siteId=291194637