Google Maps works, but MapFragment doesn´t - android

i developed an app which uses MapActivity. I have associated an API-KEY in Manifest and i´m using the google play services for the map in Gradle 10.2.0 ...
My Problem:
In my AVD and on my real Device (Galaxy s6 with Nougat, Android 7) i can see the Map and it´s loading correctly. But on some Devices it doesn´t, i don´t know why? Same API Key of course. I´m using the supportMapFragment.
for example on these phones the Map stays grey with the google logo on the bottom left corner.
also in Galaxy s3 with 4.03 and 4.1.1 it doesn´t work. On Xiaomi Mi MAX it works.
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ibas.locatixteamviewer">
<!--
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" />
<!--
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.
-->
<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 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=".MapsActivity"
android:label="#string/title_activity_maps"></activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:noHistory="true"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ListActivity"
android:label="#string/title_activity_list"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".FahrzeugActivity"
android:label="#string/title_activity_fahrzeug"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".WebActivity"
android:label="#string/title_activity_web"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".ListMapsActivity"
android:label="#string/title_activity_list_maps"></activity>
</application>
activity_maps.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="ibas.locatixteamviewer.MapsActivity">
<!--<Button-->
<!--android:id="#+id/button1"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="#359c5e"-->
<!--android:layout_alignParentTop="true"-->
<!--android:layout_alignParentEnd="true"-->
<!--android:padding="8dp"-->
<!--android:layout_margin="5dp"-->
<!--android:src="#drawable/menu_car_side_7_white"-->
<!--android:textColor="#ffffff" />-->
</fragment>
Gradle
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
testCompile 'junit:junit:4.12'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "ibas.locatixteamviewer"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Add this in your manifest top of <application> tag
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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" />

Check app permission for location service in your mobile setting .if it is not allowed then allow location and then restart the app

Related

Play Store App Device Catalog saying Track: Production Status: Unsupported

I am trying to get an app working on the Google Play. It loads on a device through Android Studio wihtout any issues and it appears to be on the store correctly. The 'View on Google Play' link on my Play Console takes me to the listing but I get this message:
Trying to find out why and looking in the device catalog I see this message on all the devices I have looked at so far (about 10 so assume it will be for all):
My manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CAMERA2" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera2" />
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="#drawable/ic_launcher_foreground"
android:label="abc"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Build Gradle
compileSdkVersion 28
defaultConfig {
applicationId "com.abc.def"
minSdkVersion 21
targetSdkVersion 30
versionCode 9
versionName "1.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Any ideas why camera2 will cause the device to be unsupported in production?

When I change minSdkVersion 8 to minSdkVersion 9

I had this problem:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com.google.android.gms:play-services:9.4.0] C:\Users\Esprit\Desktop\Alphabet AdMob\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\9.4.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
But when i change "minSdkVersion 8" to "minSdkVersion 9" I get 255 errors
Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.viavilab.alphabet"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.viavilab.alphabet.Splash_Activity"
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="com.viavilab.alphabet.CapitalAlphabet_Activity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<activity
android:name="com.viavilab.alphabet.MainActivity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<activity
android:name="com.viavilab.alphabet.SmallAlphabet_Activity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<activity
android:name="com.viavilab.alphabet.AboutActivity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!-- Activity required to show ad overlays. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:15'
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.viavilab.alphabet"
minSdkVersion 8
targetSdkVersion 18
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.android.gms:play-services:+'
}
As you can read in the official doc about Setting up Google Play Services, the minSdkVersion must be 9. Even they are informing in the release notes, Google Play services 10.0.x is the final release that includes full support for Android version 2.3.x (Gingerbread).
By the way, in your build.gradle file, replace your compileSdkVersion to 18. You are already adding google play services to your app, as you can see in your dependencies.
compileSdkVersion 18
A tip: I think is highly recommendable to set a version to libraries you are using. The plus character in a dependency means you are using the latest version of the library. Every time app is built, you will use the latest version and maybe, your app can be incompatible with it or there are some bugs in the library you don't want to include in your app. So, set the version you want to use. For example,
compile 'com.google.android.gms:play-services:10.0.1'

I'm having white map with Could not find class 'android.app.AppOpsManager'

I've build mapActivity before and it worked perfectly and map appeared... I worked on other project to get a map but it didn't work.... I back to my first mapActivity project(which was working perfectly) and lunched again (after removing its map app from my phone) but it didn't worked and give me blank map
there are the erors:
1-Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.internal.zzro.zzg
2- Could not find class 'android.app.AppOpsManager', referenced from method rv.a
3- Authentication failed. Timeout while trying to contact the server.
and thid in Manifest:
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<permission
android:name="com.example.asus.myapplicationhello.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<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="com.example.asus.myapplicationhello.permission.MAPS_RECEIVE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:largeHeap="true"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
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.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
and this is the gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.example.asus.myapplicationhello"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:multidex:1.0.0'
}

Google Play Compatibility Issue

I have released an app on Google Play that has a minimum API level of 17 (Android 4.2).
I have a test phone running Android 4.4.2.
The app is currently released only as beta. When I attempt to download it, it says its not compatible.
Has anyone got any ideas what could cause this?
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.delaneybiometrics.delaneymobile"
minSdkVersion 17
targetSdkVersion 23
versionCode 9
versionName "0.9"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'org.apache.httpcomponents:httpclient:4.5'
}
Here is the Manifest...
<?xml version="1.0" encoding="utf-8"?>
<!--
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.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!--<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>-->
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<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">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<!--
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=".PunchActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".OnSiteActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".RegisterActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".TourActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
To fix, remove the <uses-feature android:name="android.hardware.camera.autofocus" /> tag from your manifest. But dont worry, as the docs say below, your app will still work properly
http://developer.android.com/reference/android/hardware/Camera.AutoFocusCallback.html
Devices that do not support auto-focus will receive a "fake" callback
to this interface. If your application needs auto-focus and should not
be installed on devices without auto-focus, you must declare that your
app uses the android.hardware.camera.autofocus feature, in the
manifest element.

Android Studio 0.4.2 and Google Map api v2 - Error contacting Google servers

I spend some hours tring to make a new project with AS 0.4.2 and the result is again a blank map with three errors:
E/Google Maps Android API﹕ Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
E/Google Maps Android API﹕ Ensure that the following correspond to what is in the API Console: Package Name: com.demomap, API Key: AIzaSyBiYMhCKkRR-rqScAQgbetmVCCBZusgvcE, Certificate Fingerprint: DC37F5B58C2526B6FF8A6A72F8AB7A81D90F0779
E/GetJar SDK [com.zeptolab.ctr.ads]﹕ Usage: UsageRollupDatabase: collectAppSessionEvent() Failed to find or create a reporting window for an event with timestamp 1389656136587, giving up...
E/GetJar SDK [com.zeptolab.ctr.ads]﹕ Usage: UsageRollupDatabase: collectAppSessionEvent() Failed to find or create a reporting window for an event with timestamp 1389656136845, giving up...
E/Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors)
This is what I changed in build.gradle:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
}
and here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<permission
android:name="com.demomap.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.osman.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-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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=".BasicMapActivity" android:label="#string/app_name" />
<activity android:name=".LegalInfoActivity" android:label="#string/app_name" />
<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="AIzaSyBiYMhCKkRR-rqScAQgbetmVCCBZusgvcE" />
</application>
My app was working correctly wast week and now I don't know what is wrong. Tried to change the key several times and still nothing - only blank map and that message.
If I remove that line from the manifest:
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
the app is crashing with this:
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
Is there anyone who has dealt with a similar problem?

Categories

Resources