The app debug works fine but in the release doesnt work.
Here is the AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.poldevs.pabloelmapas">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCPHx0_******"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.NoActionBar">
<activity android:name=".ChatGlobalActivity"></activity>
<activity android:name=".fotoperfil" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps" />
<activity android:name=".ChatActivity" />
<activity android:name=".Mapa_Activity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I hava tried creating different API keys from google, both works on debug version but not in release, the map doesnt load.
Also I have a key for the debug version and another key for the release version (I have tried with the same key but still not working.
Have you generated the release key for google map. follow this link to generate a release key for google map.
Before publishing application into play store you have to follow some step to create release key with your app signing keystore.
An app that works in debug mode but not release mode can sometimes indicate a proguard problem. Did you try disabling proguard in build.gradle?
buildTypes {
release {
minifyEnabled false
}
}
If the app works with this change, then you'll need to modify your proguard config file.
Related
I have a tts & gps application with google api, display a map and markers on map.
when i run this app on emulator, the app works as expected but not works well in my phone with apk
I think there's a problem with the api version, but I don't know what to do.
here's my code and i attached this image which not working on my phone
if press the button the marker show my location
enter image description here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codingflow.texttospeechexample"
>
<permission android:name="wonpa.alwaysweb.com.myloctest.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="wonpa.alwaysweb.com.myloctest.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
enter code here
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.TextToSpeech">
<uses-library android:name="com.google.android.maps" />
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my api key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
</manifest>
I'm sorry if i show unnessary code
Is there a problem if you install the application on your device directly from Android Studio via a USB Debugging mode? If not, then the problem is with generating a signed APK for your device.
Also you need to secure your API key first: Using API Keys.
Take out the API KEY in string resources like that
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
I have tried to search for the solution and its like I'm navigating to no where.
I have tried this solution:
Manifest merger failed with multiple errors, see logs
but wont help me
This is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools"
xmlns:activitytools="http://schemas.android.com/apk/res-auto"
package="technerd.com.iboda">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<dist:module dist:instant="true"
/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<service
android:name=".onAppKilled"
android:stopWithTask="false" />
<activity android:name=".HistorySingle"/>
<activity android:name=".HistoryActivity" />
<activity android:name=".DriverSettings" />
<activity android:name=".SignUp" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".DriverMapsActivity"
android:label="#string/title_activity_driver_maps" />
<activity
android:name=".CustomerMapsActivity"
android:label="#string/title_activity_customer_maps" />
<activity android:name=".DriverLogin" />
<activity android:name=".CustomerLogin" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Error log in merged manifest
Merging Errors:
Error: Attribute
activity#com.google.android.libraries.places.widget.AutocompleteActivity#theme value=(#style/PlacesAutocompleteThemeOverlay) from AndroidManifest.xml:21:13-66 is also present at AndroidManifest.xml:18:13-61 value=(#style/PlacesAutocompleteOverlay). Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:16:9-23:20 to override. app main manifest (this file), line 20
Error: Attribute
activity#com.google.android.libraries.places.widget.AutocompleteActivity#windowSoftInputMode value=(stateAlwaysVisible|adjustPan) from AndroidManifest.xml:22:13-71 is also present at AndroidManifest.xml:19:13-55 value=(adjustResize). Suggestion: add 'tools:replace="android:windowSoftInputMode"' to element at AndroidManifest.xml:16:9-23:20 to override. app main manifest (this file), line 21
My question is common, but I have tried all the suggestions listed before to solve the issue of that Google Maps only shown in debug mode not in release mode.
The below have been tried (for sure I have used the SHA-1 certificate fingerprint for debug keystore and release keystore as per google documents):
Added different api Keys in the google_map_api.xml for debug and
release.
Added same key for both debug and release modes.
Write the key manually in thee Manifest.xml
Refer to the string in the Manifest.xml
Update:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
The API key for Google Maps-based APIs.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name="local.application.user.myApp.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Go to your Google api console where select the app and in left side :
Release management=> App Signing=> copy SHA-1 certificate inside App signing certificatemodule and paste into the Google cloud console and add this SHA1 with your project and save it . it will work . it works me.
After trying all suggested solutions (Thx for everyone). I tried to disable the Google Maps Api and re-enabled it again (from console.developers.google.co) and it has been working fine since then.
I'm trying to enable Google Play Games in my Adobe Air game for Android. There are 2 apps a full and a demo one. But it looks like SignIn/SubmitScore/ReportAchievement codes are just being ignored, for both apps.
I'm using this ANE, but have also tried this and it's original fork. For all the result is the same. Code "ignored", nothing happens.
My project setup:
All the project was done, compiled and packaged in FlashDevelop. Platform is Air Mobile 14.0, SDK is Adobe Air 16.0. I use my own .p12 certificate for Android package, one for each App version.
I include the ANE on FlashDevelop the same way I included Game Center
ANE, for the same APP. The Game Center one is working, so I think
this one should also be fine.
I have added my com.google.android.gms.games.APP_ID to the xml, together with the additions required by the ANE.
In my code I do (and nothing happens, no callback is called, no signal is triggered, no sign in pop up screen, but my "trace" notification is shown, so the code is reached):
Games.initialize();
addListeners(); //Adding SignIn and SignOut callbacks
Games.promptUserToSignInOnStartup(true);
Games.start();
NotificationSystem.notifyLoading("Connecting to Google Play Games Service");
On Google's Developer Console:
Both apps are published for Alpha/Beta tests, there is no Production version yet.
I've set up Play Games Services, it is "Ready to test".
Both apps have been linked to it and authorized. I verified OAuth2.0 SHA1 fingerprint for both .p12 and they match.
This is my APK's AndroidManifest.xml, as I can't imagine the problem being on code side, or Google's console side.. I think it should be somewhere on ANE's config when packaging. So it might be here:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="air.mygame">
<application android:hardwareAccelerated="false" android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:label="#string/app_name" android:launchMode="singleTask" android:name=".AppEntry" android:screenOrientation="user" android:theme="#style/Theme.NoShadow" android:windowSoftInputMode="adjustResize|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="namespaceVersion" android:value="14.0"/>
<meta-data android:name="aspectRatio" android:value="portrait"/>
<meta-data android:name="autoOrients" android:value="true"/>
<meta-data android:name="fullScreen" android:value="true"/>
<meta-data android:name="uniqueappversionid" android:value="251bf45a-b5b6-49ae-bb1a-4337f47f8f34"/>
<meta-data android:name="initialcontent" android:value="mygame.swf"/>
<meta-data android:name="containsVideo" android:value="false"/>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="MY_APP_ID_ON_GOOGLE_PLAY_GAMES"/>
<meta-data android:name="com.google.android.gms.version" android:value="4242000"/>
<activity android:name="com.google.api.games.SignInActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
<activity android:name="com.google.api.games.StubActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
</manifest>
Ok! I found the error and it was indeed in the AndroidManifest.xml.
For anyone else struggling with this, the problem is that when working with Adobe Air we don't edit AndroidManifest.xml file directly, we edit application.xml using the manifestAdditions tag. And the needed additions were going to the wrong place.
My application.xml was like:
<android>
<manifestAdditions>
<![CDATA[<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<!-- GooglePlay Games Services -->
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ MY_GOOGLE_PLAY_GAMES_APP_ID" />
<meta-data android:name="com.google.android.gms.version" android:value="4242000" />
<activity android:name="com.google.api.games.SignInActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.google.api.games.StubActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</manifest>]]>
</manifestAdditions>
</android>
Looking at Google's guide there could be no activity tag outside of the application tag on the final AndroidManifest.xml. Also, according to this, the meta-data tag should also be inside the application tag.
I just had to edit the application.xml so it looked like:
<android>
<manifestAdditions>
<![CDATA[<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<!-- GooglePlay Games Services -->
<application> <!-- This will be merged with application tag in the final manifest file -->
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ MY_GOOGLE_PLAY_GAMES_APP_ID" />
<meta-data android:name="com.google.android.gms.version" android:value="4242000" />
<activity android:name="com.google.api.games.SignInActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.google.api.games.StubActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>
</manifest>]]>
</manifestAdditions>
</android>
To open your final AndroidManifest.xml, file for checking, you can use apktool.
I've been developing my first android app using Google Maps SDK.
It work perfectly fine when i Run the application with Android Studio using my Samsung Galaxy S4. I can see maps, everything is good.
Now today, i released, and i testet it on my friends Samsung Galaxy s4. It did not show any maps. What a nightmare. What must i do? What information do i need to provide so someone can help me out?
Edit:
I signed my apk with android studio. It create some .jks file.
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<permission
android:name="de.christianbergau.gojogging.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="de.christianbergau.gojogging.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:debuggable="false"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MYAPIKEYHERE" />
<activity
android:name="de.christianbergau.gojogging.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="de.christianbergau.gojogging.SessionsActivity"
android:label="#string/title_activity_sessions" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.christianbergau.gojogging.MainActivity" />
</activity>
<activity
android:name="de.christianbergau.gojogging.MapActivity"
android:label="#string/title_activity_map" >
</activity>
<activity
android:name="de.christianbergau.gojogging.SettingsActivity"
android:label="#string/title_activity_settings" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.christianbergau.gojogging.MainActivity" />
</activity>
</application>
You were all right, this is what i did:
I did create an API Key with my debug.keystore SHA1 fingerprint.
I did create an APK file and signed it with my .jks file which android studio did create for me
I did deploy that APK and Maps could not be displayed
To fix it:
Get the SHA1 fingerprint of the jks file with the following command:
keytool -v -list -keystore /path/to/my.jks
Created new API Key on Google
Saved new API key to my manifest.xml
Upload new APK
Done
When you run app with Android Studio, your app use debug.keystore. Map work because map key generated for debug.keystore. You must generate api key for your release keystore.
When you publish your app with debug key, map looks blank. Use release key for production.
You can check this.
Google Map Android API v2 can't display map in play store application