Cordova-plugin-firebase: Erreur : élément trouvé String/google_app_id plus d'une fois

Créé le 29 oct. 2017  ·  5Commentaires  ·  Source: arnesson/cordova-plugin-firebase

Je suis confronté à un problème lors de la construction pour Android. Comme ci-dessous :
screen shot 2017-10-30 at 2 42 32 am

google_app_id et google_api_key ajoutés deux fois dans strings.xml.

Donc pour l'instant je peux me débrouiller en supprimant l'entrée mais je dois le faire à chaque fois.

Version actuelle :
Vos informations système :

Cordoue CLI : 7.1.0
Version Gulp : CLI version 3.9.1
Gulp local : version locale 3.9.1
Version du cadre ionique : 1.3.2
Version ionique de la CLI : 1.7.16
Version de l'application Ionic Lib : 0.7.3
version de déploiement d'ios : 1.9.2
Version ios-sim : Non installé
OS : Mac OS X El Capitan
Version du nœud : v6.11.4
Version Xcode : Xcode 9.0.1 Version de construction 9A1004

Commentaire le plus utile

Réparer:

Modifier les plates-formes/android/android.json

Recherchez « google_app_id » et vous en trouverez deux. Le premier avec 'translatable=\"false\"', puis 2x plus d'objets "/resources", un avec 'google_app_id' et un avec 'google_app_key'. Vous N'AVEZ PAS besoin des 2 autres donc laissez UNIQUEMENT le premier (avec 'translatable=\"false\"').

Maintenant, cela ne fonctionnera toujours pas car vous devez également modifier plates-formes/android/res/value/strings.xml et faire de même : supprimez les 2 paramètres supplémentaires google_app_id et google_app_key après le premier avec 'translatable=\"false \"' dedans.

Vous pouvez maintenant compiler sans aucune erreur.

Tous les 5 commentaires

Même problème. Voici le fichier strings.xml situé à /platforms/android/res/values/strings.xml avec les entrées en double :

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name">Jasper Government</string>
    <string name="launcher_name">@string/app_name</string>
    <string name="activity_name">@string/launcher_name</string>
    <string name="google_app_id">1:739999999999:android:b738888888888888</string>
    <string name="google_api_key">AIzaSySySySySySySySySySySySySySySySySySy</string>
    <string name="google_app_id">@string/google_app_id</string>
    <string name="google_api_key">@string/google_api_key</string>
</resources>

Je suis également confronté à ce problème.

J'ai réussi à surmonter le problème. Lorsque j'exécute "ionic cordova [build || run] android, la tâche "ionic cordova prepare android" écrit dans le fichier strings.xml :

< string name="google_app_id" >[at]string/google_app_id< /string>
< string name="google_api_key" >[at]string/google_api_key< /string>

À cause de cela, la tâche de génération échoue. J'ai réussi à faire des builds en exécutant la tâche "ionic cordova prepare android", puis j'ai supprimé manuellement les deux lignes de strings.xml. Après cela, je construis l'apk à partir d'Android Studio. Et répétez. Développer, préparer, supprimer, construire, installer, répéter, :). J'espère que cela aide quelqu'un.

ionique ionique

packages cli : (C:\Users\userAppData\Roaming\nvm\v6.9.0node_modules)
[at]ionic/cli-utils : 1.18.0
ionique (Ionic CLI) : 3.18.0
forfaits mondiaux :
cordoue (Cordova CLI) : 7.1.0
forfaits locaux :
[at]ionic/app-scripts : 3.1.0
Plateformes Cordova : android 6.3.0 ios 4.5.3
Cadre ionique : ionique-angulaire 3.9.2
Système:
Nœud : v6.9.0
npm : 3.10.8
OS : Windows 10
Variables d'environnement:
ANDROID_HOME : non défini
Divers :
backend : héritage<

DES DOSSIERS

package.json

{
"nom": "nom du projet",
"version": "1.0.0",
"author": "ServusTECH Soft",
"page d'accueil": " http://servustech.com/ ",
"privé": vrai,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
" ionic:build " : " ionic-app-scripts build ",
" ionic:serve " : " ionic-app-scripts serve "
},
"dépendances": {
"[at]angular/common": "5.0.0",
"[at]angular/compiler": "5.0.0",
"[at]angular/compiler-cli": "5.0.0",
"[at]angulaire/noyau": "5.0.0",
"[at]angular/forms": "5.0.0",
"[at]angulaire/http": "5.0.0",
"[at]angular/platform-browser": "5.0.0",
"[at]angular/platform-browser-dynamic": "5.0.0",
"[at]ionic-native/camera": "^4.4.0",
"[at]ionic-native/core": "4.3.3",
"[at]ionic-native/firebase": "^4.4.0",
"[at]ionic-native/image-picker": "^4.4.0",
"[at]ionic-native/splash-screen": "4.3.3",
"[at]ionic-native/status-bar": "4.3.3",
"[at]ionique/stockage": "2.1.3",
"com.synconset.imagepicker": "~2.1.8",
"cordova-android": "~6.3.0",
"cordova-plugin-camera": "^3.0.0",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-firebase": "^0.1.24",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-telerik-imagepicker": "^2.1.8",
"cordova-plugin-whitelist": "^1.3.1",
"ionique-angulaire": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"[at]ionic/app-scripts": "3.1.0",
"dactylographié": "2.4.2"
},
"description": "Un projet ionique",
"cordova": {
"plugins": {
"cordova-plugin-firebase": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-camera": {},
"com.synconset.imagepicker": {
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "a besoin de votre permission pour accéder à vos images."
}
},
"plateformes": [
"Android",
"ios"
]
}
}<

config.xml

#

>
< ?xml version='1.0' encoding='utf-8'?>
< widget id="" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
< nom> NOM DE L'APP
< description>Une application géniale Ionic/Cordova.
< author email="hi[at]ionicframework" href="http://ionicframework.com/">Équipe Ionic Framework
< content src="index.html" />
< origine de l'accès=" " />< allow-intent href="http:// / " />< allow-intent href="https:// / " />< allow-intent href="tel: " />
< allow-intent href="sms: " />< allow-intent href="mailto: " />
< allow-intent href="geo: " />< préférence name="ScrollEnabled" value="false" />< nom de préférence="android-minSdkVersion" value="16" />< préférence name="BackupWebStorage" value="none" />< préférence name="SplashMaintainAspectRatio" value="true" />< préférence name="FadeSplashScreenDuration" value="300" />< préférence name="SplashShowOnlyFirstTime" value="false" />< préférence name="SplashScreen" value="screen" />< nom de préférence="SplashScreenDelay" value="3000" />< nom de la plate-forme="android">< allow-intent href="market: " />
< icondensity="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
< icône ...
<splashdensity="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
< éclaboussures ...
< /plateforme>
< nom de la plate-forme="ios">
< allow-intent href="itms:*" />
< allow-intent ...
< icon height="57" src="resources/ios/icon/icon.png" width="57" />
< icône ...
< splash height="1136" src="resources/ios/splash/Default-568h[at]2x~iphone.png" width="640" />
< éclaboussures ...
< /plateforme>
< nom du moteur="android" spec="~6.3.0" />
< nom du plugin="cordova-plugin-firebase" spec="^0.1.24" />
< nom du plugin="ionic-plugin-keyboard" spec="^2.2.1" />
< nom du plugin="cordova-plugin-whitelist" spec="^1.3.1" />
< nom du plugin="cordova-plugin-device" spec="^1.1.4" />
< nom du plugin="cordova-plugin-splashscreen" spec="^4.0.3" />
< nom du plugin="cordova-plugin-ionic-webview" spec="^1.1.16" />
< nom du plugin="cordova-plugin-camera" spec="^3.0.0" />
< nom du plugin="com.synconset.imagepicker" spec="~2.1.8">
< variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="a besoin de votre permission pour accéder à vos images." />
< /plugin>
< nom du moteur="ios" spec="~4.5.3" />
< /widget >
<

@robertarnesson une idée comment y remédier ? une solution de contournement ?

@robertarnesson dans prepare_after.js

remplacé

if (directoryExists(IOS_DIR)) {
    copyKey(PLATFORM.IOS);
} else if (directoryExists(ANDROID_DIR)) {
    copyKey(PLATFORM.ANDROID, updateStringsXml)
}

pour

if (directoryExists(IOS_DIR)) {
    copyKey(PLATFORM.IOS);
} 
if (directoryExists(ANDROID_DIR)) {
    copyKey(PLATFORM.ANDROID, updateStringsXml)
}

l'a réparé !

Réparer:

Modifier les plates-formes/android/android.json

Recherchez « google_app_id » et vous en trouverez deux. Le premier avec 'translatable=\"false\"', puis 2x plus d'objets "/resources", un avec 'google_app_id' et un avec 'google_app_key'. Vous N'AVEZ PAS besoin des 2 autres donc laissez UNIQUEMENT le premier (avec 'translatable=\"false\"').

Maintenant, cela ne fonctionnera toujours pas car vous devez également modifier plates-formes/android/res/value/strings.xml et faire de même : supprimez les 2 paramètres supplémentaires google_app_id et google_app_key après le premier avec 'translatable=\"false \"' dedans.

Vous pouvez maintenant compiler sans aucune erreur.

Cette page vous a été utile?
0 / 5 - 0 notes