我在Windows 8上使用Android Studio 2.3.2,并且在构建应用程序时出现错误。 首先,在启动IDE时的gradle构建期间,我有以下警告:
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is
ignored for debug as it may be conflicting with the internal version
provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is
ignored for release as it may be conflicting with the internal version
provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is
ignored for debugAndroidTest as it may be conflicting with the internal
version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is
ignored for debug as it may be conflicting with the internal version
provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is
ignored for release as it may be conflicting with the internal version
provided by Android.
然后在apk版本中有2个警告并且出现此错误:
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is
ignored for release as it may be conflicting with the internal version
provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is
ignored for debug as it may be conflicting with the internal version
provided by Android.
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: C:\Users\giorgia\.gradle\caches\modules-2\files-
2.1\com.fasterxml.jackson.core\jackson-
core\2.2.3\1a0113da2cab5f4c216b4e5e7c1dbfaa67087e14\jackson-core-2.2.3.jar
File2: C:\Users\giorgia\.gradle\caches\modules-2\files-
2.1\com.fasterxml.jackson.core\jackson-
annotations\2.2.3\527fece4f23a457070a36c371a26d6c0208e1c3\jackson-
annotations-2.2.3.jar
File3: C:\Users\giorgia\.gradle\caches\modules-2\files- 2.1\org.apache.httpcomponents\httpmime\4.3.6\cf8bacbf0d476c7f2221f861269365b664
47f7ec\httpmime-4.3.6.jar
File4: C:\Users\giorgia\.gradle\caches\modules-2\files-
2.1\com.fasterxml.jackson.core\jackson-
databind\2.2.3\3ae380888029daefb91d3ecdca3a37d8cb92bc9\jackson-databind-
2.2.3.jar
File5: C:\Users\giorgia\.gradle\caches\modules-2\files- 2.1\org.apache.httpcomponents\httpcore\4.4.3\e876a79d561e5c6207b78d347e198c8c45
31a5e5\httpcore-4.4.3.jar
答案 0 :(得分:0)
您需要在“应用”中使用packaginOptions。 build.gradle文件,在buildToolsVersion之后:
packagingOptions {
exclude 'META-INF/LICENSE'
}
答案 1 :(得分:0)
尝试将此添加到 buiild.gradle ,
之所以出现,是因为您没有排除存在于多个依赖项中的packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
exclude 'META-INF/LICENSE' // will not include LICENSE file
// as noted by @Vishnuvathsan you may also need to include
// variations on the file name. It depends on your dependencies.
// Some other common variations on notice and license file names
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
文件
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
OR 启用multiDex
const Comp = () => (
<div>
<h3> Test 1 </h3>
<hr/>
<ul className="nav nav-pills">
<li className="active"><a data-toggle="pill" href="#home">Home</a></li>
<li><a data-toggle="pill" href="#menu1">Menu 1</a></li>
<li><a data-toggle="pill" href="#menu2">Menu 2</a></li>
</ul>
<div className="tab-content">
<div id="home" className="tab-pane fade in active">
<h3>HOME</h3>
<p>Some content.</p>
</div>
<div id="menu1" className="tab-pane fade">
<h3>Menu 1</h3>
<p>Some content in menu 1.</p>
</div>
<div id="menu2" className="tab-pane fade">
<h3>Menu 2</h3>
<p>Some content in menu 2.</p>
</div>
</div>
</div>
);
ReactDOM.render( <Comp /> ,
document.getElementById('root')
);