科尔多瓦地理定位插件和科尔多瓦 Firebase 插件冲突
Posted
技术标签:
【中文标题】科尔多瓦地理定位插件和科尔多瓦 Firebase 插件冲突【英文标题】:Cordova geolocation plugin & cordova firebase plugin conflicting 【发布时间】:2019-07-29 10:58:52 【问题描述】:我在使用两个插件时遇到了这个问题:
cordova-plugin-geolocation-firebase
和 cordova-plugin-firebase
。
似乎他们俩都尝试添加导致构建失败的扩展名googleServices
。对此的任何帮助都会非常有帮助:)
FAILURE: Build failed with an exception.
* Where:
Script 'app/platforms/android/cordova-support-google-services/www-build.gradle' line: 16
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
> Cannot add extension with name 'googleServices', as there is an extension already registered with that name.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
app/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Script 'app/platforms/android/cordova-support-google-services/www-build.gradle' line: 16
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
> Cannot add extension with name 'googleServices', as there is an extension already registered with that name.
谢谢。
这是我的 AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="2" android:versionName="0.0.2" package="kz.starget.www" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.transistorsoft.locationmanager.license_key" android:value="" />
<service android:exported="true" android:name="com.transistorsoft.cordova.backgroundfetch.HeadlessJobService" android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver android:name="com.transistorsoft.cordova.backgroundfetch.HeadlessBroadcastReceiver">
<intent-filter>
<action android:name="$applicationId.event.BACKGROUND_FETCH" />
</intent-filter>
</receiver>
<provider android:authorities="$applicationId.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
</provider>
<activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="@style/Theme.AppCompat.Light" />
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
【问题讨论】:
请发布您的 AndroidManifest.xml。我认为您必须手动从 AndroidManifest.xml 中删除扩展名之一。 @KishanBharda 我已经添加了 AndroidManifest.xml。请看一看。 【参考方案1】:更改 Projected.properties
文件替换那些
cordova.system.library.4=com.google.android.gms:play-services-gcm:11.0.1
cordova.system.library.5=com.google.android.gms:play-services-location:11.0.1
这些与你的问题有关
https://github.com/jeduan/cordova-plugin-facebook4/issues/507
https://forum.ionicframework.com/t/failed-to-apply-plugin-class-com-google-gms-googleservices-googleservicesplugin/101086/11
【讨论】:
以上是关于科尔多瓦地理定位插件和科尔多瓦 Firebase 插件冲突的主要内容,如果未能解决你的问题,请参考以下文章