2017-03-08 13 views
0

最近、Android Studio 2.3にアップグレードされましたが、getAdapterPosition(RecyclerView)が見つかりませんでした。ウェブ上では、その理由はサポートライブラリのバージョンであることがわかりました。しかし、私はまだそれを解決する方法がわかりません。私のサポート:appcompat-v7:25.2.0 'のバージョンが最新です(たとえば、21以上)。私はなぜ方法が見つからないのか分からない。アドバイスをお願いしますか?getAdapterPosition()がメソッドとして見つかりません

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:[email protected]') { // 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' 
+0

getLayoutPositionを(拡張クラス内のこのメソッドを使用していることを確認する必要があり

)は、アイテムの位置を取得するためのより良いオプションです。あなたが解決策を見つけられない場合、これを使用しようとすることができます –

答えて

3

ViewHolderクラスでこのメソッドを使用していることを確認してください。

getAdapterPostion()RecyclerView.ViewHolderする方法です。あなたはRecyclerView.ViewHolder

+0

それは単純でした:私はViewHolderクラスの外でそれを使用していました。それを指摘してくれてありがとう! :) –

1

この依存関係を追加してください: コンパイル 'com.android.support:recyclerview-v7:23.3.0'

+0

提案に感謝します。しかし、それはエラーを取り除かなかった:/ –

1

は、おそらくあなたもbuildToolsVersion 25.2.0を使用する必要があり、私の場合のGradle

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

私はcustomtabsため、このバージョンを使用するように強制的にこの行compile 'com.android.support:customtabs:25.2.0'を追加しなければならなかったこの問題を解決するには、次の私とエラーを示しました。

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

後::前

あなたは、このようなエラーを持っている場合、私はあなたが望むバージョンでエラーを示しライブラリを追加することをお勧めいたします

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

2
compile 'com.android.support:recyclerview-v7:25.2.0' 

この行はありませんか?

+0

私はそれを試みた。それは事実ではなかった。しかし、提案してくれてありがとう! :) –

関連する問題