여러 dex 파일이 Lorg / apache / cordova / BuildHelper를 정의합니다.
어제부터 곤경에 처해 있습니다. 인턴십에서 다음과 같은 빌드 오류가 발생했지만 이유를 이해할 수 없었습니다.
$ cordova build android
[...]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':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/apache/cordova/BuildHelper;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.379 secs
Error: /home/thor/Projects/App_CDP/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':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/apache/cordova/BuildHelper;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
다음은 출력입니다 cordova plugins list. 보시다시피 support-v4 / v13 충돌이 없습니다.
$ cordova plugin list
com.googlemaps.ios 2.2.0-fixed "Google Maps SDK for iOS"
com.moust.cordova.videoplayer 1.0.1 "Video Player"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-file 4.0.0 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 1.4.0 "phonegap-googlemaps-plugin"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
{}
다음은 몇 가지 추가 정보입니다.
$ cordova -v
7.0.1
$ ionic -v
2.1.4
대부분의 경우 당신은 새로 출시 된 사용하는 cordova-android@6.3.0지금 포함하는 BuildHelper.java (당신의 오류 메시지에 명시된 바와 같이)과 PermissionHelper.java을 ,하지만 당신은 여전히되지 않는이 코르도바 - 플러그인-의 compat 때문에 실패 할 빌드의 원인이되는 프로젝트에를 그것은 이러한 클래스가 포함되어 있습니다 .
이 문제를 해결하려면 cordova-plugin-compat프로젝트에서 제거하여 cordova-android플랫폼 프로젝트 에서 다음 Java 파일을 제거하십시오.
cordova plugin rm cordova-plugin-compat --force
최신 정보
이 변경 사항을 유지하려면 Java 파일이 플랫폼 에 다시 설치되지 않도록 cordova-plugin-compat@1.2하는 엔진 제약 조건 을 포함하는 추가 cordova-android@6.3+:
cordova plugin add cordova-plugin-compat@1.2
다른 업데이트 (댓글에서 복사 붙여 넣기)
cordova-plugin-compat@1.2를 제거하고 추가 한 후 전체 Android 플랫폼을 제거하고 추가하는 대신 platform / android 폴더에서 BuildHelper.java 및 PermissionHelper.java 파일 만 제거 할 수 있습니다.
저에게 맞는 솔루션이 없기 때문에 2 센트를 추가 할 것입니다. 나를 위해 일한 유일한 것 :
cordova plugin rm cordova-plugin-compat --force
cordova platform rm android
cordova platform add android@6.3.0
나는해야했다 :
cordova plugin rm cordova-plugin-compat --force
cordova plugin add cordova-plugin-compat@1.2
cordova platform rm android
cordova platform add android@6.3.0
cordova-plugin-file과 같은 플러그인이 의존하기 때문에 단순히 cordova-plugin-compat를 제거 할 수 없다는 것을 고려하십시오.
질문에 이미 답변 한 것을 알고 있지만 공식 릴리스 노트에 대한 링크를 추가하고 싶습니다.
https://cordova.apache.org/news/2017/11/10/plugins-release.html
In our last plugins release, we deprecated cordova-plugin-compat since it got integrated into cordova-android@6.3.0. So for this release cycle, we have removed the dependency from plugins that were relying on it and gave the plugins a major version jump. The follow plugins have dropped cordova-plugin-compat: cordova-plugin-camera, cordova-plugin-contacts, cordova-plugin-file, cordova-plugin-geolocation, cordova-plugin-media, and cordova-plugin-media-capture.
So, make sure you update all listed plugins to the version posted in release notes.
One solution: downgrade cordova android platform @6.2.3
$ cordova platform remove android && cordova platform add android@6.2.3
With my Ionic 3 project it was enough to run:
ionic cordova plugin rm cordova-plugin-compat --force
ionic cordova plugin add cordova-plugin-compat@1.2
And then run a build again. No need to remove and add the platform.
I'am using for Ionic 3 Project, I have to do:
ionic cordova plugin rm cordova-plugin-compat --force
ionic cordova plugin add cordova-plugin-compat@1.2
ionic cordova platform rm android
ionic cordova platform add android@6.3.0
it's work for me.
i had the same error, and i didn't have compat plugin in my plugins, i just run that code, then i built, it worked fine
$ cordova platform remove android && cordova platform add android@6.2.3
cordova plugin rm cordova-plugin-compat --force
cordova platform rm android
cordova platform add android@6.3.0
cordova plugin add cordova-plugin-compat@1.2
in this order, works for me !! thanks a lot
This is the solution:
cordova plugin rm cordova-plugin-compat --force
I confirm that Answer by DaveAlden Works !!
But in the plugin.xml inside the cordova-plugin-compat I had a syntax error with less than sign '<', because it's illegal in xml.
This issue appears in visual studio, and you can't install plugin with the config manager because it detects this syntax error in xml on the plugin resource.
You must install with command line like DaveAlden says.
Ignore errors, And after install replace :
<engine name="cordova-android" version="<6.3.0"/>
by
<engine name="cordova-android" version="<6.3.0"/>
And compilation run at the end!! :)
I have remove the Compat plugin after the update the dependency of other plugins; like Camera to the new version and it's work. Example: cordova plugin rm cordova-plugin-camera --save cordova plugin add cordova-plugin-camera@latest --save Post the new plugin addition the old version 2.3.0 was replaced with 4.0.2 for Camera plugin.
after this step. I have simply remove the plugin "Compat" cordova plugin rm cordova-plugin-compat --force
On Resume. This mean that plugin-camera is not compatible with the last version of android oreo
I am using Ionic 4 and this solved it for me (only takes a few seconds to run):
cordova clean
There may be mismatch of the plugins in the android builds. So better run 2 commands for successful build
cordova platform rm android
cordova platform add android
After wasted 2 days this seems to be only working solutions for me.
Remove plugin cordova-plugin-compat forcefully android sdk above version 6.3.0 or equal because it is integrated with cordova android.
cordova plugin rm cordova-plugin-compat --force
As a reference below
https://cordova.apache.org/announcements/2017/09/27/android-release.html
'IT TIP' 카테고리의 다른 글
| ASP.NET Custom Validator 클라이언트 측 및 서버 측 유효성 검사가 실행되지 않음 (0) | 2020.10.30 |
|---|---|
| 열 (GridView)을 숨기지 만 여전히 해당 값에 액세스하는 방법은 무엇입니까? (0) | 2020.10.30 |
| 레일스 콘솔이 libreadline으로 인해로드되지 않습니다. (0) | 2020.10.30 |
| 파일 삭제를위한 MSBuild 작업 구문 (0) | 2020.10.30 |
| 두 변수의 값을 바꾸는 PHP 함수가 있습니까? (0) | 2020.10.30 |