Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Found item String/google_app_id more than one time #468

Closed
dhavalsoni2001 opened this issue Oct 29, 2017 · 5 comments
Closed

Error: Found item String/google_app_id more than one time #468

dhavalsoni2001 opened this issue Oct 29, 2017 · 5 comments

Comments

@dhavalsoni2001
Copy link

I am facing an issue while building for android. As below :
screen shot 2017-10-30 at 2 42 32 am

google_app_id and google_api_key added twice in strings.xml.

So for now I can manage by removing entry but I have to do it for each time.

Current version :
Your system information:

Cordova CLI: 7.1.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.2
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.9.2
ios-sim version: Not installed
OS: Mac OS X El Capitan
Node Version: v6.11.4
Xcode version: Xcode 9.0.1 Build version 9A1004

@camtera
Copy link

camtera commented Nov 7, 2017

Same issue. Here is the strings.xml file located @ /platforms/android/res/values/strings.xml with the duplicate entries:

<?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>

@marinescud
Copy link

I am facing also this problem.

Managed to get over the problem. When I run "ionic cordova [build || run] android, the "ionic cordova prepare android" task is writing in the strings.xml file the:

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

Because of that the build task fails. I managed to do builds by running "ionic cordova prepare android" task, then I manually delete the two lines from strings.xml. After that I build the apk from Android Studio. And repeat. Develop, prepare, delete, build, install, repeat, :). Hope this helps somebody.

ionic ionfo

cli packages: (C:\Users\user\AppData\Roaming\nvm\v6.9.0\node_modules)
[at]ionic/cli-utils : 1.18.0
ionic (Ionic CLI) : 3.18.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
[at]ionic/app-scripts : 3.1.0
Cordova Platforms : android 6.3.0 ios 4.5.3
Ionic Framework : ionic-angular 3.9.2
System:
Node : v6.9.0
npm : 3.10.8
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : legacy<

FILES

package.json

{
"name": "project name",
"version": "1.0.0",
"author": "ServusTECH Soft",
"homepage": "http://servustech.com/",
"private": true,
"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"
},
"dependencies": {
"[at]angular/common": "5.0.0",
"[at]angular/compiler": "5.0.0",
"[at]angular/compiler-cli": "5.0.0",
"[at]angular/core": "5.0.0",
"[at]angular/forms": "5.0.0",
"[at]angular/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]ionic/storage": "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",
"ionic-angular": "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",
"typescript": "2.4.2"
},
"description": "An Ionic project",
"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": " needs your permission to access your images."
}
},
"platforms": [
"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">
< name>APP NAME
< description>An awesome Ionic/Cordova app.
< author email="hi[at]ionicframework" href="http://ionicframework.com/">Ionic Framework Team
< content src="index.html" />
< access origin="" />
< allow-intent href="http://
/" />
< allow-intent href="https://
/" />
< allow-intent href="tel:
" />
< allow-intent href="sms:" />
< allow-intent href="mailto:
" />
< allow-intent href="geo:" />
< preference name="ScrollEnabled" value="false" />
< preference name="android-minSdkVersion" value="16" />
< preference name="BackupWebStorage" value="none" />
< preference name="SplashMaintainAspectRatio" value="true" />
< preference name="FadeSplashScreenDuration" value="300" />
< preference name="SplashShowOnlyFirstTime" value="false" />
< preference name="SplashScreen" value="screen" />
< preference name="SplashScreenDelay" value="3000" />
< platform name="android">
< allow-intent href="market:
" />
< icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
< icon ...
< splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
< splash ...
< /platform>
< platform name="ios">
< allow-intent href="itms:*" />
< allow-intent ...
< icon height="57" src="resources/ios/icon/icon.png" width="57" />
< icon ...
< splash height="1136" src="resources/ios/splash/Default-568h[at]2x~iphone.png" width="640" />
< splash ...
< /platform>
< engine name="android" spec="~6.3.0" />
< plugin name="cordova-plugin-firebase" spec="^0.1.24" />
< plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
< plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
< plugin name="cordova-plugin-device" spec="^1.1.4" />
< plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
< plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
< plugin name="cordova-plugin-camera" spec="^3.0.0" />
< plugin name="com.synconset.imagepicker" spec="~2.1.8">
< variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value=" needs your permission to access your images." />
< /plugin>
< engine name="ios" spec="~4.5.3" />
< /widget >
<

@faustoct1
Copy link

@robertarnesson any ideia how fix it ? any workaround?

@faustoct1
Copy link

faustoct1 commented Nov 19, 2017

@robertarnesson in prepare_after.js

replaced

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

for

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

fixed it!

@Ziv-Barber
Copy link

To fix it:

Edit platforms/android/android.json

Search for 'google_app_id' and you'll find 2 of them. The first with ' translatable="false"' and then 2x more "/resources" objects, one with 'google_app_id' and one with 'google_app_key'. You DON'T need the 2 other ones so leave ONLY the first one (with ' translatable="false"').

Now it'll still not going to work because you need to edit also platforms/android/res/value/strings.xml and do the same: remove the 2 extra google_app_id and google_app_key settings after the first one with ' translatable="false"' in it.

Now you can compile without any errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants