getAdapterPosition() is not found as a method - android

I recently uprated to Android Studio 2.3 and not the getAdapterPosition (RecyclerView) cannot be found. I saw on the web that the reason for that is the support library version. But I am not sure how to solve it still. My support:appcompat-v7:25.2.0' version is the latest possible (e.g. above 21). I don't understand why the method is not found. Any advice, please?
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 files('libs/wekaSTRIPPED.jar')
compile('com.mikepenz:materialdrawer:5.8.1#aar') { // Material Drawer
transitive = true
}
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.google.dagger:dagger:2.9'
compile 'com.github.wendykierp:JTransforms:3.1'
compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.borax12.materialdaterangepicker:library:1.9'
compile 'com.evernote:android-job:1.1.7' // Scheduling library
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'

Can you please check you are using this method in ViewHolder Class?
getAdapterPostion() is the method of RecyclerView.ViewHolder.
You need to make sure you are using this method inside the class extending RecyclerView.ViewHolder

compile 'com.android.support:recyclerview-v7:25.2.0'
may be missing that line ???

Please add this dependency:
compile 'com.android.support:recyclerview-v7:23.3.0'

Probably you have to use buildToolsVersion 25.2.0 too, and in my case the gradle showed me and error:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 25.2.0, 25.0.0. Examples include
com.android.support:animated-vector-drawable:25.2.0 and
com.android.support:customtabs:25.0.0
To solve this I have had to add this line compile 'com.android.support:customtabs:25.2.0' forcing to use this version for customtabs.
Before:
// android support
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
After:
// android support
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
If you have an error like this, I recommend you to add the library that shows the error with the version you want.

Related

Build failed with bytecode error in Android Studio

I have this error:
I have enabled multidex but still it gives me multidex files define issues.
compile fileTree(include: ['*.jar'], dir: 'libs')
// Navigation Drawer Library
compile('com.mikepenz:materialdrawer:5.3.0#aar') {
transitive = true
}
// Debugger Tools libraries
debugCompile 'com.facebook.stetho:stetho:1.2.0'
debugCompile 'com.parse:parseinterceptors:0.0.2'
//Google, Inc (Play services) Libraries
compile 'com.google.android.gms:play-services-maps:9.2.0'
// Google, Inc (Support) Libraries
compile 'com.android.support:support-v13:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
// Parse Server API SDK
compile project(':ParseUI-Widget')
compile 'com.parse:parse-android:1.13.1'
compile 'com.parse.bolts:bolts-android:1.4.0'
compile 'com.github.tgio:parse-livequery:1.0.3'
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
// Facebook, Inc SDKs
compile 'com.facebook.android:audience-network-sdk:4.18.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.facebook.android:account-kit-sdk:4.+'
// Libraries for loading images
compile 'com.facebook.fresco:imagepipeline-okhttp3:0.11.0+'
compile 'com.facebook.fresco:fresco:1.0.0'
// Location Helper Library
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
// Time library
compile 'joda-time:joda-time:2.9.7'
// Accelaration library
//compile 'com.neumob:neumob-android:3.2.4'
// Others
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/mint-4.4.0.jar')
I have added build.gradle file.
I don't know how to solve Multidex issue in Android. My app has lots of SDKs integration, I went through lots of tutorials and blogs. I got so many solutions. One of them is below mentioned as part of my gradle.
apply plugin: 'com.google.gms.google-services'
classpath 'com.google.gms:google-services:3.1.1'

Integrate FirebaseUI to app/build.gradle cause crash at runtime

Adding
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
into dependencies of the app/build.grandle File, cause an Error every Time I call FirebaseAuth.getInstance(). Before I added the new gradle Dependency, every FirebaseAuth.getInstance() Call works fine and also I was able to load Data from FirebaseDatabase.
Iam doing this Tutorial: FirebaseUI for Android — Auth. What did I wrong?
Update 1: Put the calls into an Try/Catch Block doesnt work. The Debbuger does not step into the catch Part.
UPDATE 2:
What is the Error? Answer: I dont get an Error. The Logcat Box do not print any Error Message. Also I cant figgure out the error via debugging, becaus the Catch-Block dont get reached.
My app/build.gradle:
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 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
testCompile 'junit:junit:4.12'
//Firebase
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
//FirebaseUI
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile('com.facebook.android:facebook-android-sdk:4.22.1') // Required only if Facebook login support is required
}
apply plugin: 'com.google.gms.google-services'
To solve this, change this lines of code:
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
with
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
Make sure to using right version number for firebase-ui-auth at gradle. You can read the official document: https://firebase.google.com/docs/android/setup
Just check the compatibility:
FirebaseUI Version Firebase/Play Services Version
2.3.0 11.0.4
If you want to use the firebase-ui 2.3.0 you have to use firebase 11.0.4.
Use:
//Firebase
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
//FirebaseUI
compile 'com.firebaseui:firebase-ui-auth:2.3.0'

Gradle com.android.support and com.google.android.gms library conflict

I'm working on a Firebase chat app inside my main project and I added Firebase dependencies to my build.gradle, but then I got this message after sync:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes.) Found versions 25.3.1, 25.0.0, 23.4.0. Examples include com.android.support:animated-vector-drawable:25.3.1 and com.android.support:palette-v7:25.0.0
on
compile 'com.android.support:appcompat-v7:25.3.1'
and
All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes.) Found versions 9.8.0, 10.2.6. Example include com.google.android.gms:play-services-auth-base:9.8.0 and com.google.android.gms:play-services-ads-lite:10.2.6
on
compile 'com.google.android.gms:play-services-ads:10.2.6'
Here is my dependencies in build.gradle (Module:app):
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 files('lib/mysql-connector-java-5.1.6.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:10.2.6'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
//Chat dependencies
compile 'com.android.support:design:25.3.1'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.github.hani-momanii:SuperNova-Emoji:1.0'
}
according to your build.gradle file,
duplicate line of code found
compile 'com.android.support:design:25.3.1'
remove one and try .

In Android Studio, all com.android.support libraries must use the exact same version

I recently upgraded to Android Studio 2.3. and this error started appearing:
Here is my list of libraries:
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 files('libs/wekaSTRIPPED.jar')
compile('com.mikepenz:materialdrawer:5.8.1#aar') { // Material Drawer
transitive = true
}
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.google.dagger:dagger:2.9'
compile 'com.github.wendykierp:JTransforms:3.1'
compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.borax12.materialdaterangepicker:library:1.9'
compile 'com.evernote:android-job:1.1.7' // Scheduling library
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
Any idea on how to solve this?
I had the problem like you when updating to Android Studio 2.3. I solved by I searched in my project all support library using 25.1.1 (I searched 25.1.1) and replace with 25.2.0. I think many code using 25.1.1, in your library and your project.
You can open external lib in your project to show all dependency. You should update to new library version(lib using support library):
For ex:
https://github.com/mikepenz/MaterialDrawer - new version is 5.8.2 using 25.2.0

InstaBug, cannot resolve 'Builder'

Trying to implement InstaBug first time, however, when I initialize it,
new Instabug.Builder(this, "XXXXXXXXXXXXXXXXXXXX")
.setInvocationEvent(Instabug.IBGInvocationEvent.IBGInvocationEventShake)
.build();
Android Studio says cannot resolve symbol Builder
Though Builder extends from java.lang.Object , helpless to figure why this happens. Any fix?
EDIT:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.code.gson:gson:2.5'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile "com.google.android.gms:play-services:8.4.0"
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:design:+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.commit451:PhotoView:1.2.4'
compile 'net.danlew:android.joda:2.9.1'
compile project(":volley")
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile ("com.instabug.library:instabugsupport:+") { exclude group: 'com.mcxiaoke.volley', module: 'library' }
Instabug.Builder was introduced in v2+ of Instabug SDK.
Can you try specifying the latest version of Instabug in your gradle, as follows:
compile('com.instabug.library:instabugcompat:2.2.1')
P.S: v2.2.1 was latest at the time of writing
P.S2: instabugcompat is the equivalent of instabugsupport in v2+
P.S3: Instabug doesn't include Volley anymore so you don't need to exclude it anymore
For more details, don't hesitate to ask. And you can check this out as well as #m-d mentioned

Categories

Resources