我正在与Ionic 2合作开展一个专业项目。我将在星期一(2017年4月24日)与客户进行演讲。不幸的是从上周五我面临与cordova插件的冲突。该应用程序适用于IOS,但使用Android构建失败。我认为冲突伴随着:
在开始时我遇到版本冲突,所以我将版本更改为cordova-plugin-mauron85-background-geolocation,其中 framework src =“com.google.android.gms:play-services-location:9.0 0.0" 。错误是:
Found com.google.android.gms:play-services-location:+, but version 9.0.0 is needed for the google-services plugin.
:processDebugGoogleServices FAILED
解决版本冲突后,现在我遇到了一个新问题。问题是:
:transformClassesWithDexForDebug
FAILED
>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 Lcom/google/android/gms/common/api/zza;
因为我总是在我的控制台中发出以下消息,我试图手动修复它。我尝试应用一些我通过搜索找到的解决方案。
控制台中的消息是:
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
手动修复是在我的平台/ android / build.graddle中添加以下行(在正确的位置):
但是我通过这个修改得到了以下错误,所以我删除了它们:
>FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
Cannot add task ':processDebugGoogleServices' as a task with that name already exists.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
我的平台/ android / project.properties:
target=android-24
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-fcm/myProjectV2-FCMPlugin.gradle
cordova.gradle.include.2=cordova-plugin-mauron85-background-geolocation/myProjectV2-logtofile.gradle
cordova.system.library.3=com.google.android.gms:play-services-location:9.0.0
cordova.system.library.4=com.android.support:support-v4:+
希望我会得到一些帮助。 感谢。