Closed yeray697 closed 6 years ago
I got I think the same message, but for me it's the first time I use it just by following tutorial here.
android { compileSdkVersion 27 defaultConfig { applicationId "xxxx" minSdkVersion 16 targetSdkVersion 27 versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true multiDexEnabled true }
and compile 'com.schibstedspain.android:leku:3.6.2'
any help please? thanks
Anyone got solution? facing same problem
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing com/schibstedspain/leku/geocoder/AndroidGeocoderDataSource.class Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26) Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'. com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\LENOVO\.gradle\caches\transforms-1\files-1.1\Leku-v3.6.1.aar\62f61824453626d1b8a315182ef0c4e7\jars\classes.jar
@yeray697 @aymenhs @rahuldange09 are you using the new D8 dexer?
Because this looks like an error with the D8, it's not working very well. Please try to add to your build file gradle.properties
this line:
android.enableD8=false
Well, adding that line gives me less errors, but setting enableD8 to true works.
Anyway, it still gives me an error while building intent
Intent i = new LocationPickerActivity.Builder() .withGeolocApiKey(getString(R.string.google_maps_key)) .withSearchZone("es_ES") .build(getContext());
Error:
java.lang.NoClassDefFoundError: com.schibstedspain.leku.LocationPickerActivity at com.schibstedspain.leku.LocationPickerActivity$Builder.build(LocationPickerActivity.java:1143)
@ferrangrau as @yeray697 said same happening here changed android.enableD8=true solved that issue but as @yeray697 mentioned getting same error now
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/OnMapReadyCallback;
@rahuldange09 @yeray697 that's strange. Because different classes are failing without a reason. Please could you tell me which version of Play Services are you using? And which devices are you experiencing this issue? Are you using proguard?
@ferrangrau Version of Play Services gms11.8.0(gradle) / 11.9.73(device)
Device Xiaomi Redmi Note4 but with Custom rom
Are you using proguard? Not In debug mode
@rahuldange09 have you tried with the emulator or other device? Because If the device is rooted and you're using a custom rom I can't figure out how to solve the problem and I can't give you support.
Iβve tried with both, I donβt know if the physical device is rooted or not Could be the new android studio version the problem?
@yeray697 are you using a "canary" version or the stable one?
Stable version, but I haven't got a similar error pre 3.0
@ferrangrau Tried on other devices still same yes i'm also in stable version of Android Studio
I have no physical device to test right now, but with emulator i'm not able to get an address with
new Geocoder(getContext(), Locale.getDefault())
.getFromLocation(latitude, longitude, 1)
but I was able to get it with higher versions, I don't know if it's related to the same error (?)
I'll try it later with another device
@yeray697
NoClassDefFoundError
this error solved for you?
Not yet
But in this you said
I have no physical device to test right now, but with emulator i'm not able to get an address with
new Geocoder(getContext(), Locale.getDefault())
.getFromLocation(latitude, longitude, 1)
but I was able to get it with higher versions, I don't know if it's related to the same error (?)
This means that its working right? you are just not able to get address. So you on older version?
@yeray697 if you're no able to get an address from the emulator is due to probably you're using an emulator without google apis. Also, geocoder could fail or not retrieve an address.
@rahuldange09 @yeray697 do you have a GeocoderPressenter class in your project? Because this could be another reason why Dex is failing.
BTW I'm @ferranpons and not @ferrangrau π
@ferranpons I'm extremely sorry... github recommendation. No i don't have GeocoderPressenter class in my project.
@rahuldange09 no worries π
Do you have multidex enabled? That's the only thing could make this kind of error apart from the other things I asked before.
@ferranpons yes i have multidex enabled and tried after disabling it but still with this error same mentioned above
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/OnMapReadyCallback;
at com.......getLocation(LoacationAccessActivity.java:226)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.OnMapReadyCallback" on path: DexPathList
@rahuldange09 you don't have to disable multidex, It's needed if you surpass the limit of java classes. (65K)
Please, could you share the build.gradle without any sensible data?
@ferranpons yes I enabled multidex again
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.name.myapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
//Optional: see how to use the utility.
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1@aar'
//Maps
compile 'com.github.SchibstedSpain:Leku:v3.6.2'
//Vertical
compile 'me.kaelaela:verticalviewpager:1.0.0@aar'
//rss
compile 'com.github.faruktoptas:RetrofitRssConverterFactory:0.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
}
@rahuldange09 well, you are using a compile that is not the correct one and you're targeting api 27 and the library is not supporting it for now (has api 26). So maybe you need to exclude support library and play services from the compile because will have conflicts for sure. Like:
implementation ('com.schibstedspain.android:leku:3.6.2') {
exclude group: 'com.google.android.gms'
exclude group: 'com.android.support'
}
BTW I'm upgrading the project to api 27 https://github.com/SchibstedSpain/Leku/pull/135
@rahuldange09 @yeray697 version 3.7.0 with api 27 and gms 11.8.0 now available for download.
implementation ('com.schibstedspain.android:leku:3.7.0') {
exclude group: 'com.google.android.gms'
exclude group: 'com.android.support'
}
@ferranpons thank you for your instant upgrade but sorry, its strange that error is still same π€
@rahuldange09 I don't get it. The error is related with the Dexing process. π€
Are you sure that you have implemented correctly multidex? I mean, do you extend your application class with MultiDexApplication
or do you use the method MultiDex.install(this);
on your attachBaseContext
method? Or use the android:name="android.support.multidex.MultiDexApplication"
on your manifest?
Any of these 3 possible things could make work correctly multidex.
I ask you this to discard more possibilities because I don't know where is the problem. π
Well, I've been testing and Leku works good for me until 3.6.0.
This gradle is working for me, but not for >= 3.6.0
(Testing with api 16)
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 26
versionCode
versionName ""
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
}
...
dependencies {
implementation 'com.schibstedspain.android:leku:3.5.0'
}
@yeray697 I don't know where could be the problem. I could ask you the same as I asked to @rahuldange09. Have you correctly implemented multidex?
Have you added a new library apart from updating Leku?
I'm getting without of ideas π
I think so, I have multiDexEnabled true and compile 'com.android.support:multidex:1.0.1', besides having my Application class extending from MultiDexApplication. I tried overriding attachBaseContext too (without extending) , but I still get the same error. Did I skip some step?
No, I haven't added a new library
@rahuldange09 I have reviewed your build.gradle again, you have duplicated this lines:
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
You only need the "implementation" lines. Compile is deprecated.
@yeray697 which error are you still experiencing? The "no class found" or Geocoder not retrieving location?
I'm still geting java.lang.NoClassDefFoundError: com.schibstedspain.leku.LocationPickerActivity while using >= 3.6.0
compileSdkVersion 27
buildToolsVersion '27.0.2'
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 27
versionCode
versionName ""
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
...
dependencies {
...
def supportVersion = '27.0.2'
def playServicesVersion = '11.8.0'
implementation 'com.schibstedspain.android:leku:3.7.0'
...
}
@yeray697 Did you add the activity to the manifest? π€
Yes, I have
<activity
android:name="com.schibstedspain.leku.LocationPickerActivity"
android:label="@string/leku_title_activity_location_picker"
android:parentActivityName=".view.activity.Home_Activity"
android:theme="@style/AppTheme_LocationPicker"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/leku_searchable" />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".view.activity.Home_Activity" />
</activity>
I'm doing some test, and in api 21 and 23 I get more information about the crash: https://pastebin.com/E2261HWv
(By the way, you forgot to change on readme the leku prefix in android:resource="@xml/searchable"
)
@yeray697 If you're using an emulator with api 21 it's possible that you have this kind of error because it has a bug with Instant Run. Are you using Instant Run? If you're using it please disable it and make a clean and rebuild project because it's probably not generating correctly the Dex path for your APK. Sounds weird but it happens.
Also I suggest you to use a most up-to-date emulator with a higher API version
Sorr for the long delay for the response. Yes, I've already disable Instant Run and it still fails. I'm updating Android Studio in other computer to check if it's my laptop fault
Well, I don't know what happened, but now it's working.
I was getting this warning all com.android.support libraries must use the exact same version [...]
, I solved it, and now it's working, I don't know if that error can cause NoClassDefFoundError Β―_(γ)_/Β―
Thanks for your support :)
@yeray697 good to know that is working now. π
@rahuldange09 are you still experiencing this issue?
I have good and bad news. The bad one is that I got the error again (?) The good one is that cloning it and importing it as a module to the project works good
I think it's android studio's fault.
Take a look to this solution @rahuldange09
@rahuldange09 any news about that? I'm closing the Issue, if you are still experiencing that problem please re-open the issue or open a new one.
Thanks!
Description
It works fine with 3.4.5, but in pre lollipop device gives me ClassNotFoundException, so I decided to upgrade Leku to the newest The problem is that it doens't compile. I'm using Java 8 I've also tried to clean project, invalidating cache and restarting and removing manually .gradle/cache
(I'll test it later with a clean project)
Info Required
Which version of the library do you actually use? 3.6.2
Do you have the localization permission granted? Yes
Are you sending parameters to the activity through the bundle?
Could you describe what are the actions do you make to raise that error? Compiling and running in device
Android monitor shows any log related to the library when the error is shown? Gradle messages
Full Gradle Console messages run with --stacktrace