Since the last update for android support libraries, I am having issues with importing LruCache. Eclipse, and now even android studio, keep saying that package android.suppo
In my case I was porting an Android Googlemaps app API1 to API2, and after many hours I realized I was not adding
C:\Program Files\..(your_path_)..
..\adt-bundle-windows-x86_64\sdk\extras\android\support\v4
to External Libraries..
Hope this helps
Go to your Android SDK's directory and:
jar tvf ./extras/android/support/v13/android-support-v13.jar |grep v4.*util
And within this jar file you can see one of the classes (under v4/util) you have used in your applications.
0 Wed Mar 26 20:29:48 SGT 2014 android/support/v4/util/
3373 Wed Mar 26 20:29:48 SGT 2014 android/support/v4/util/ArrayMap.class
5329 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/MapCollections.class
1625 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/ContainerHelpers.class
3677 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/MapCollections$KeySet.class
1220 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/DebugUtils.class
3435 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/AtomicFile.class
1287 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/LogWriter.class
3701 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/MapCollections$ValuesCollection.class
4446 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/MapCollections$EntrySet.class
5910 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/SparseArrayCompat.class
3273 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/TimeUtils.class
5776 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/LongSparseArray.class
5680 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/LruCache.class
3341 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/MapCollections$MapIterator.class
1575 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/MapCollections$ArrayIterator.class
2439 Wed Mar 26 20:29:48 SGT 2014 android/support/v4/util/ArrayMap$1.class
8611 Wed Mar 26 20:29:46 SGT 2014 android/support/v4/util/SimpleArrayMap.class
So the error "package android.support.v4.util does not exist" simply means you have to copy the above jar file to your libs subdirectory and recompile.
Step-1: Open Project in AndroidStudio3.3 or above, wait until loading of the project completes.
Step-2: Right click 'app' -> Refactor -> Migrate to AnroidX
Step-3: Review the changes in AndroidStudio console below and click 'Do Refactor'
The issue will be fixed.
After trying tweaking build.gradle different ways, ended up with solution found here: https://github.com/kmagiera/react-native-gesture-handler/issues/394#issuecomment-508358572
in short - you can solve it with jetifier
:
npm install --save-dev jetifier
npx jetify
From the package docs:
If you use React Native modules with native Java code that isn't converted to AndroidX, and your app is AndroidX, you probably need this.
In my case, the solution was eventually found as documented here:
<sdk>/extras/android/support/v4/android-support-v4.jar
) into your application's project libs/ directory.For those importing the support libraries using gradle like this:
// compat libraries
compile 'com.android.support:support-v4:23.2.0' // v4
compile 'com.android.support:appcompat-v7:23.2.0' // v7
compile 'com.android.support:support-v13:23.2.0' //v13
Remember to remove this all*.exclude module: 'support-v4' from configurations
configurations {
//all*.exclude module: 'support-v4'
}
...might have been a dummy mistake from my part though :)