Android - Could not find class ClusterManager? - android

I added compile 'com.google.maps.android:android-maps-utils:0.4+' in may project :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.ir.zanis.mycluster"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
But when I run app get me crash :
And here is my Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ir.zanis.mycluster">
<!--
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.google.maps.android.utils.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.google.maps.android.utils.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="#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.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".ClusteringDemoActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
I've struggled for two days because of the problem .Thanks for your help

My problem solved :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-maps:9.2.1'
compile 'com.google.android.gms:play-services-places:9.2.1'
compile 'com.google.maps.android:android-maps-utils:0.4+'
}

Related

Google Maps API displaying grey screen instead of map view on Android

I am trying to display the Google map on Android. When I load the activity i get a grey screen with the Google logo displayed in the bottom left corner. This happens using the virtual emulator and on a real device too. I have tried using a different Api key but get the same problem. I am using the Map activity provided by Android studio.
build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="">
<uses-feature
android:name="android.hardware.sensor.stepcounter"
android:required="true" />
<uses-feature
android:name="android.hardware.sensor.stepdetector"
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gfs.permission.READ_GSERVICES" />
<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"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".Activities.LandingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".UserAccountActivities.ProfileActivity" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="redacted" />
<activity
android:name=".Activities.MapsActivity"
android:label="#string/title_activity_maps" />
</application>
</manifest>
Logcat in Error mode
01-02 15:06:24.913 17090-17160/E/Google Maps Android API: Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
01-02 15:06:24.923 17090-17160/ E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: ***
Android Application (<cert_fingerprint>;<package_name>): ***;
go to Google console and try to enable maps sdk for android...
try to change the hardware-sensors to not required:
<uses-feature
android:name="android.hardware.sensor.stepcounter"
android:required="false"/>
<uses-feature
android:name="android.hardware.sensor.stepdetector"
android:required="false"/>
and also this permission is not required anymore, for years:
<uses-permission android:name="com.google.android.providers.gfs.permission.READ_GSERVICES" />
and the problem actually stems from:
apply plugin: "com.google.gms.google-services"
which has to be moved to the very bottom of the file.

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'
}

app-release.apk showing "Parse error: There is a problm parsing application"

I have checked many answers but none of them helped
I am running it 5.1.1 android, and in build.gradle it is minSdkVersion as 15 so it should work.
I am able to run app-debug.apk on same device without any issue.
I have not renamed apk file after that, i have signed it for the first time manually in android studio.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.raghav.pokemonfinder"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.android.support:design:23.4.0'
apply plugin: 'com.google.gms.google-services'
compile 'com.firebase:firebase-client-android:2.4.0'
compile 'com.google.android.gms:play-services-location:9.0.2'
compile 'me.sargunvohra.lib:pokekotlin:2.2.3'
}
and here is my androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.raghav.pokemonfinder">
<!--
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" />
<application
android:name="Utils.PokeMonFinder"
android:allowBackup="true"
android:icon="#drawable/icon2"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/MyMaterialTheme">
<!--
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 android:name=".MapsShowActivity" />
<activity
android:name=".SplashScreenActivity"
android:theme="#android:style/Theme.Light.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SubmitPokemon" />
<activity android:name=".PokemonDetailActivity" />
<activity
android:name=".HomeActivity"
android:label="#string/title_activity_home"
android:theme="#style/MyMaterialTheme" />
<activity android:name=".MyPokemonActivity" />
</application>
</manifest>

Error .dex exceeds 64k android studio

When i try to run the program, i get error exceeds 64k
I don't know how to solve this. I had already try the resolve but it still failed and give me more error. Please help me
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.timslbl.geogencybaru"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.roughike:bottom-bar:1.2.1'
compile 'com.google.http-client:google-http-client-android:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.api-client:google-api-client-gson:+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.2.1'
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.timslbl.geogencybaru">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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.WRITE_EXTERNAL_STORAGE" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<aplication
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="" />
<activity android:name=".MapActivity" />
<activity android:name=".MainActivity"></activity>
<activity android:name=".LoginActivity"></activity>
<activity android:name=".RegisterActivity"></activity>
</aplication>
</manifest>
This is the error that i got after try the resolve
I highly suggest not to compile compile 'com.google.android.gms:play-services:8.4.0'
as it is,
Which is one of the main cause of 64K method dex limit.
The separate compilations beyond play-services itself is listed Here, Use the one you really need rather than compiling the whole play-services.
Is your project a very large one? I'm suspecting that it may be going over the method limit of 64k. Have a look at this documentation. It may help.

any suggest? Failure [INSTALL_FAILED_OLDER_SDK]

my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.vladxd.trackingpoint_2"
minSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
}
and here is my Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.vladxd.trackingpoint" >
<!-- To access Google+ APIs: -->
<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="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.vladxd.trackingpoint.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyB5HcvlWp6AAUBU65Iq7CC_huQi_yK1XG8" />
</application>
</manifest>
Do u have any idea how I can solve it? I've try to find this problem on another post from stackoverflow but all that don't work for me... and I don't know why.
So if u have any idea pls told me :D
Sry for my bad english.
The gradle file sets the build to be minSdk of 21 which is Android 5.0. The error is basically saying that the device you're attempting to install on has an older os.
If go into the device settings -> About Phone there should be an entry that shows your Android Version. That should then line up with the values from http://developer.android.com/reference/android/os/Build.VERSION_CODES.html

Categories

Resources