I'm trying to write a simple app with a WebView, but when I create a WebView I get an error:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/TracingController;
I searched and found that TracingController is implemented from api level 28, but I only have 27.
How can I resolve this?
Might be late but helpful if someone has the same issue.I had same issue on my project and I figured out that issue is with the SDK version 28.
- If you use the below sets of dependencies then you will not have this issue.
compileSdkVersion 27
buildToolsVersion '28.0.3'
minSdkVersion 16
targetSdkVersion 26
Also, I have included the dependencies used in my project. I have used MoPub SDK for Ads and Google AdMob & Facebook mediation adapters.
compile "com.android.support:appcompat-v7:27.1.1"
compile "com.android.support:design:27.1.1"
compile 'com.android.support.constraint:constraint-layout:1.1.3'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true
}
compile 'com.android.support:multidex:1.0.3'
compile "com.google.firebase:firebase-core:16.0.1"
compile "com.google.firebase:firebase-ads:15.0.1"
compile "com.google.android.gms:play-services-analytics:15.0.0"
compile "com.google.firebase:firebase-config:15.0.0"
compile 'com.google.android.ads.consent:consent-library:1.0.6'
// Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
/* Mopub SDK */
compile('com.mopub:mopub-sdk:5.3.0#aar') {
transitive = true
}
compile 'com.mopub.mediation:admob:15.0.0.11'
compile 'com.mopub.mediation:facebookaudiencenetwork:5.0.0.0'
compile 'com.facebook.android:audience-network-sdk:5.0.0'
same issue here, only appearing on Android 8 in ionic after building with --release. The app shows the splash screen and then is stuck in white screen
I'm dipping my feet into android / gradle builds. And saw this line is some of the examples
compile "com.android.support:appcompat-v7:23.0.1"
Not entirely sure what this is. My project is targeting api 26 with minSdkVersion of 23.
When would I use appcompat and in my case do I need to use 23 or 26?
AppCompat is a set of support libraries which can be used to make the apps developed with newer versions to work with older versions.In your case AppCompat is there to support version 23
my advice is to design your gradle like this:
ext {
supportLibVersion = '27.0.1' //this should be the latest published version
}
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:palette-v7:${supportLibVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
compile "com.android.support:gridlayout-v7:${supportLibVersion}"
Something behind the scenes happened and my project will no longer build and/or run because of a conflict in the dependency stack.
I have tried to tinker with the version numbers of the dependencies and can confirm that the facebookSDK project is set to build with support lib v22. How can I figure out what is causing the v23 appcompat support lib to get pulled into my project?
Here's the build error I am getting:
/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/res/values-v23/values-v23.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
And the gradle info:
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
}
}
dependencies {
compile project(':facebookSDK')
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:multidex:1.0.0'
...
}
Facebook with its facebook-android-sdk tries to keep their dependencies as latest as possible. You had an issue with 23.0.0Android support libraries version, I with 23.1.1...:-)
I highly recommend to change your existing configuration to this one:
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:multidex:1.0.0'
...
compile 'com.facebook.android:facebook-android-sdk:4.+'
}
Look, you can even add facebook-android-sdk as Gradle's dependencies, so you can delete existin folder and don't bother about stay fresh with it.
You can also stay with your a bit low targetSdkVersion, which is good when you don't want to implement things like Android permissions or Doze mode compability.
Hope it will help
You can update these lines to the latest versions without affecting which API level you can run the code at. You are missing the v23 resources, so compile with at least version 23.
compileSdkVersion 22
buildToolsVersion "22.0.1"
These lines should be the same version, but they aren't even needed when you use the support:design library. Feel free to delete these.
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
For this line, I highly doubt that you are using all of the Google play services. Please read about only using those you really need in your app.
compile 'com.google.android.gms:play-services:8.4.0'
After you narrowed down those possibilities, I'd suggest you use these (from experience, seems to work fine).
compile 'com.android.support:design:23+'
compile 'com.android.support:cardview-v7:23+'
Since you haven't shown the Facebook dependencies, it's hard to give advice about that
I installed ALL Extra and SDK API 21-22 including changed
compileSdkVersion 22 to 21 and buildToolsVersion '22.0.1' to 21.1.2.
I'm having Rendering Problems for API 22.
I have tried changing the version to <= 21 but I'm still getting an error.
These are the correct version that you can add in your build.gradle according to the API needs.
API 24:
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:recyclerview-v7:24.2.1'
API 25:
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
API 26:
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
API 27:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
In order to make that working I had to set:
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
compile ("com.android.support:design:22.2.0")
Documentation states something different (docs):
com.android.support:support-design:22.0.0
Real path for Support Repository Libraries:
You should download Support Repository Libraries.
If the problem still exists:
Go to the real path of your Support Repository Libraries and check that the following folder exists:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support"
In that folder there are support libraries that can't be found.
for example:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7"
Open folder appcompat-v7 and you see folders with all available version. You should use only one of these versions in the build.gradle file dependencies or use +, for ex. 18.0.+
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
That is the path taken from grade.build dependencies file:
com.android.support:appcompat-v7:18.0.0
Refer to the real path on your HDD -->
ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7\18.0.0
If there is no such folder, you will receive the error:
"failed to resolve com.android.support:appcompat-v7:18.0.0"
p.s. If you have Windows x64, when installing sdk and jdk, make sure that the installation path does not have Program Files(86). Brackets that add Windows may cause additional problems with resolving paths for your project. Use simple paths for your installation folder.
For example:
c:\androidSDK\
Failed to find: com.android.support:appcompat-v7:22.0.0
The "I literally tried everything else" answer:
This problem will also occur if you don't have an upto date Android Support Library and Android Support Repository. Just install using the SDK manager.
Along with other provided solutions, make sure to have the following within project/build.gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
in support libraries you always need to add three numbers as version number
Suppose for 22 -> you need to write it as 22.0.0, not just 22
for 22.1 -> 22.1.0
So your dependencies should look like this
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
I Programmers language you need to pad extra zeros.
Hope this solves your problem
i solve it
change 22.0.0 to 21.0.3
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:appcompat-v7:21.0.3' }
maybe i have download the com.android.support:appcompat-v7:21.0.3 but have not got the compile 'com.android.support:appcompat-v7:22.0.0'
when i use SDK Manager update my support library and support repository , the problem dismissed.
NOTE1: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
NOTE2: Support library should not use a different version than the compileSdkVersion
For API 28 you can use:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0-alpha1
https://mvnrepository.com/artifact/com.android.support/recyclerview-v7/28.0.0-alpha1
All support libraries: https://mvnrepository.com/artifact/com.android.support
It is easier to use "+" sign in the version number. For example
compile 'com.android.support:support-v4:22.0.+'
compile "com.android.support:appcompat-v7:22.0.+"
In this case you won't have to change versions for the same API number
Go to Messages Gradle Sync, and Click on Install Repository and sync project. This is will install needed file in Android SDK and after syncing you will be able to create gradle or run your project.
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Are you import them? Like this:
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
paste the above code in your app gradle.
and while setting up the project select empty activity instead of blank activity.
Fixed my issue by changing these
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
to
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
that means your target SDK version should be same as version of cardView and recyclerView and other google libraries.
targetSdkVersion 23
Tools > Android > SDK Manager
Select all of the packages that are not up to date and update them.
I had such dependancy in build.gradle -
compile 'com.android.support:recyclerview-v7:+'
But it causes unstable builds. Ensure it works ok for you, and look in your android sdk manager for current version of support lib available, and replace this dependency with
def final RECYCLER_VIEW_VER = '23.1.1'
compile "com.android.support:recyclerview-v7:${RECYCLER_VIEW_VER}"
I solved the problem updating all packages from Android SDK Manager and also, I had to install Extras -> Android Support Repository.
I have a problem - I imported the project in Android Studio. When I run the project I get the following error:
Error:Execution failed for task ':driverNotes:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
Dependencies in build.gradle:
dependencies {
compile project(':facebookSDK')
compile project(':vKOpenAuthActivity')
compile project(':easyFousquareActivity')
compile project(':pullToRefresh')
compile project(':volley')
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
compile 'com.google.android.gms:play-services:+'
compile files('libs/commons-codec-1.9.jar')
compile files('libs/signpost-commonshttp-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.2.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/httpclientandroidlib-1.2.0.jar')
}
I used java 7. How can I get rid of this error message?
Android L Preview build cannot target previous Android version. I think com.android.support:support-v4:21.0.0-rc1 is built for Android L Preview only, try to change the version to 20+ pending v21 release
EDIT :
It's possible that Google Play Services includes android-support-v4:21.0.0-rc1 . Avoid using + in gradle dependencies (i use it only for minor versions), last version of Google Play Services is 5.2.08 from Android L Preview, try to replace compile 'com.google.android.gms:play-services:+' with compile 'com.google.android.gms:play-services:5.0.89'
If you're getting these problems nowadays (now that Lollipop is available), then it may mean that you're using an old version of the support library. As noted in the known issues on the Android Tools site:
If your build fails with an error message like this:
:app:processDebugManifest app/src/main/AndroidManifest.xml:0:0 Error:
uses-sdk:minSdkVersion 19 cannot be smaller than version L declared in library app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0-rc1/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
you are using an obsolete version of the Android support libraries. Open up the SDK manager and update to the latest (non-preview) versions.