Error .dex exceeds 64k android studio - android

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.

Related

module was not opening using dynamic feature in android

I am working on the dynamic feature module. I uploaded the .aab file into playstore some times app is unable to open the module throwing the error like this.
This is the error getting in logcat:
PID: 12715
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.testDynamic/com.testDynamic.zco.ZcoActivity}:
java.lang.ClassNotFoundException: Didn't find class
"com.testDynamic.zco.ZcoActivity"
on path: DexPathList[[zip file
"/data/app/com.testDynamic-1/base.apk",
This issue here is my code.
This is my Main app 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"
package="com.testDynamic">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<dist:module dist:instant="true" />
<application
android:name=".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">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here is my module Manifest:
<?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"
package="com.testDynamic.zco"
split="dynamiczco">
<dist:module
dist:onDemand="true"
dist:title="#string/title_test">
<dist:fusing dist:include="true" />
</dist:module>
<application>
<activity
android:name="com.testDynamic.module.ZcoActivity"
android:label="#string/title_activity_test"
android:theme="#style/AppTheme.NoActionBar">
</activity>
</application>
</manifest>
Here is my main gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.testDynamic"
minSdkVersion 23
targetSdkVersion 27
versionCode 33
versionName "3.1"
}
dynamicFeatures = [":dynamicmodule",":dynamic_feature2",":dynamiczco"]
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api 'com.android.support:appcompat-v7:27.1.1'
api 'com.android.support:recyclerview-v7:27.1.1'
api 'com.google.android.play:core:1.3.1'
api 'com.android.support.constraint:constraint-layout:1.1.2'
api 'com.squareup.retrofit2:retrofit:2.1.0'
api 'com.squareup.retrofit2:converter-gson:2.1.0'
api 'com.android.support:cardview-v7:27.1.1'
}
Here is my module gradle:
apply plugin: 'com.android.dynamic-feature'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 20
targetSdkVersion 27
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
// implementation 'com.google.android.material:material:27.0.+'
}
Anyone have an idea about this error please help me to resolve
Anyone help to solve this issue.
Thanks in advance.
Hi after researching i got the solution. Now the module was downloading without any crash.
I changed the module manifest
<dist:module
dist:onDemand="true"
dist:title="#string/title_test">
<dist:fusing dist:include="true" />
to
<dist:module
dist:instant="true"
dist:onDemand="false"
dist:title="#string/title_test">
<dist:fusing dist:include="true" />
</dist:module>
It is working fine.
Thank you all

app:transformClassesWithDexForDebug exception and java.util.concurrent.ExecutionException

I am getting below Error while running my Application.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
I think the issue is with my .gradle file. Maybe some duplication for dependency in my .gradle file. I have removed one but, still getting the error.
My .gradle file is as below.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.mypackagename"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.android.support:cardview-v7:24.2.+'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.google.android.gms:play-services-auth:11.0.2'
}
}
My Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackagename">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.roadysmart.permission.MAPS_RECEIVE" />
<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_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
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>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"></activity>
<activity
android:name=".UserProfileEditActivity"
android:label="User Profile"
android:screenOrientation="portrait" />
<activity
android:name=".SignInActivity"
android:label="Sign In"
android:screenOrientation="portrait" />
<activity
android:name=".SelectActivity"
android:label="Were here to help"
android:screenOrientation="portrait" />
<activity
android:name=".SignUpActivity"
android:label="Sign Up"
android:screenOrientation="portrait" />
<activity
android:name=".ForgotPasswordActivity"
android:label="Forgot Password"
android:screenOrientation="portrait" />
<activity
android:name=".UserProfileActivity"
android:label="User Profile"
android:screenOrientation="portrait" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaS0000000014789occURS5KvtKgfdreWjaDI" />
</application>
Try adding multiDexEnabled true in defaultConfig.
Moreover, its not recommended to use com.google.android.gms:play-services:11.0.2 directly rather include the dependencies you want to work with separately. Like if you want to work with Google Maps, then add only com.google.android.gms:play-services-maps:11.1.0 and so on.
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
You've hit the dex limit for the number of methods that can be used in which affects all device lower than Android 5.0(21).
To fix this you need to enable multi-dex in your gradle and have your application extends MultiDexApplication to work around with the max Dex limit.
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true
}
...
}

Eclipse migration NoClassDefFound GooglePlayServicesClient$ConnectionCallbacks

i have a problem with my code.
So far I worked with Eclipse, but now i work with Android Studio.
(In Eclipse)
I have a library project called MoST, that requires google_play_service_r16 library project. To import this project in Android Studio:
1) In Eclipse I add google_play_service_r16 to MoST.
2) Export file as build.gradle.
3) Finally i imported build.gradle and then create MoST.aar in Android Studio.
In Android Studio i created a new project that uses the MoST module. When i try to run my new application i have this error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.unipa.uniar, PID: 23978
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;
at org.most.MoSTApplication.onCreate(MoSTApplication.java:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5881)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1718)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.GooglePlayServicesClient$ConnectionCallbacks" on path: DexPathList[[zip file "/data/app/com.unipa.uniar-2/base.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.unipa.uniar-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.unipa.uniar-2/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at org.most.MoSTApplication.onCreate(MoSTApplication.java:66) 
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5881) 
at android.app.ActivityThread.-wrap3(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1718) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6688) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) 
My app module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.unipa.uniar"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':most')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-base:10.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/weka-3.6.6-android.jar')
compile files('libs/org.apache.commons.io.jar')
compile files('libs/bcprov-jdk15on-155.jar')
compile files('libs/apache-httpcomponents-httpclient.jar')
compile files('libs/httpcore-4.4.6.jar')
}
(Most module) AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.most"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permission for activity recognition -->
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<application
android:name="org.most.MoSTApplication"
android:allowBackup="false"
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" />
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:launchMode="singleInstance" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="MoSTService"
android:enabled="true" >
</service>
</application>
</manifest>
The error says Most Didn't find class "com.google.android.gms.common.GooglePlayServicesClient$ConnectionCallbacks"
How can i fix the problem?
SOLUTION
GooglePlayServicesClient class has been deprecated for some time. Recent versions of google play services such as 10.2.1 can create a variety of problems. In my case I can not use newer versions as I can not edit library directly. To solve the problem have included the version of google play service 4.3.23, that include the GooglePlayServiceClient and I solved the problem. AndroidManifest.xml (final):
<?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="com.unipa.uniar">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Permission for Network -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Permission for activity recognition -->
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<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.Light"
tools:replace="android:allowBackup,android:icon,android:theme">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".Welcome"
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=".LoginActivity" />
<activity android:name=".TrainingSet" />
<activity android:name=".Testing"></activity>
</application>
</manifest>
and this is the gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.unipa.uniar"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':most')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services:4.3.23'
testCompile 'junit:junit:4.12'
compile files('libs/weka-3.6.6-android.jar')
compile files('libs/org.apache.commons.io.jar')
compile files('libs/bcprov-jdk15on-155.jar')
compile files('libs/apache-httpcomponents-httpclient.jar')
compile files('libs/httpcore-4.4.6.jar')
}

ClassDefNoFound on API 22 x_86 level API

I am facing a strange problem in API level 22 (lollipop) mobiles.
Mobiles using these API levels are working fine
API 24
API 23
But when i run my app on API level 22 mobile, it gives me following error message.
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.Picasso"
on path: DexPathList[[zip file
"/data/app/com.myapp.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.app-1/lib/x86, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
However this is not Picasso related problem, if i remove Picasso library it starts giving me error messages on other classes.
Process: com.myapp.app, PID: 16327
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/myapp/app/VideosListActivity
at com.myapp.app.MainActivity$8.onClick(MainActivity.java:422)
Gradle FIles (App)
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId 'com.myapp.app'
minSdkVersion 21
targetSdkVersion 24
versionCode 26
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
lintOptions {
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':common')
compile project(':commonwidget')
compile project(':videowidget')
compile 'com.android.support:multidex:1.0.1'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
compile 'org.glassfish:javax.annotation:10.0-b28'
compile 'io.card:android-sdk:5.4.0'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
compile 'com.github.michaelye.easydialog:easydialog:1.4'
compile 'org.jsoup:jsoup:1.8.3'
compile 'me.grantland:autofittextview:0.2.+'
repositories {
flatDir {
dirs 'libs'
}
}
Gradle - Project
buildscript {
repositories {
jcenter()
}
dependencies {
/**/
/* classpath 'com.android.tools.build:gradle:1.2.3'*/
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:2.1.0'
classpath 'com.google.code.gson:gson:2.2.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.app">
<uses-permission android:name="android.permission.INTERNET" />
<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.CALL_PHONE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application
android:name=".AnalyticsSampleApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<service android:name=".ticketing.services.LogoutService" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".SplashDefaultActivity" />
</activity>
<activity
android:name=".DirectionsActivity"
android:label="#string/title_activity_directions"
android:parentActivityName=".MapsActivity"
android:theme="#style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".SplashDefaultActivity" />
</activity>
<activity
android:name=".SplashDefaultActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
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=".SplashVideoActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".VideosListActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/title_activity_videos_list"
android:screenOrientation="portrait"
android:theme="#style/AppTheme" />
<activity
android:name=".VideoActivity"
android:configChanges="orientation|screenSize"
android:label="#string/title_activity_video"
android:theme="#style/AppTheme" />
Did you manually re-sync gradle after your changes? Did you also change build-tools version in your build.gradle to match API 22 as well? The errors you're showing I've only seen when gradle hasn't rebuilt or resynced properly. I would also try to manually do it from the command line... (in OS X), ./gradlew clean, ./gradlew assemble

Android - Could not find class ClusterManager?

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

Categories

Resources