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 have installed play services in sdk tools and added following libs though it shows the problem
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.firebase:geofire-android:2.1.1'
compile 'com.google.gms.google-services:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-drive:15.0.1'
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.github.jd-alexander:library:1.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Remove com.google.gms.google-services:15.0.1 from dependencies, that is a gradle file plugin not an dependency.
def mySupportVersion = "26.1.0"
dependencies {
compile "com.android.support:appcompat-v7:$mySupportVersion"
compile "com.android.support:design:$mySupportVersion"
compile "com.android.support:cardview-v7:$mySupportVersion"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.firebase:geofire-android:2.1.1'
compile "com.google.android.gms:play-services-maps:15.0.1"
compile "com.google.android.gms:play-services-drive:15.0.1"
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.github.jd-alexander:library:1.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You should use def for flexibility when changing version.
The options can be
change versions of play services
remove unused services
if using maps, check permission of google place api
[https://firebase.google.com][1] should be proper configured
google-play.json file should be updated with project.
I think unchecking Offline work option may solve the problem. Check My Answer Here.
A lot of problems can cause this issue:
1) Check if you have Maven/Google repository on your top level main build.grade (can be found on your project root folder):
allprojects {
repositories {
jcenter()
google()
}
}
2) Check if you have the correct library number on your module App build.grade (can be found on \app) :
https://developer.android.com/topic/libraries/support-library/packages
3) Check buildToolsVersion and targetSdkVersion on your module App build.grade (can be found on \app):
Sometimes it's not possible to download anything if buildToolsVersion is not set to the new version. Check this site: https://developer.android.com/studio/releases/build-tools
4) Check internet connection and firewall issues
This is so simple, but nobody checks...
5) Check if Android Studio is set to Offline Work:
File ->
Other Settings ->
Default Settings ->
Build, Execution, Deployment ->
Build Tools ->
Gradle -> Uncheck Offline Work
6) If nothing works, click on Android Studio "clean project" and then "invalidade cache/restart":
Build->Clean Project
File->Invalidade Cache/Restart
Good Luck!
just change the play service version to 15.0.0 and sync the gradle
I was using SDK 23 but the system of permissions make me come back to the SDK 22, but I'm facing a problem that is quite common here. I visited every link but no one could really help me.
The error that I'm facing is this one:
I have my manifest like this:
And my gradle file is like this:
dependencies {
compile files('ormlite-android-4.49-SNAPSHOT.jar')
compile files('ormlite-core-4.49-SNAPSHOT.jar')
compile files('ormlite-jdbc-4.49-SNAPSHOT.jar')
compile files('signalr-client-sdk.jar')
compile files('signalr-client-sdk-android.jar')
compile project(':viewPageIndicator')
compile project(':netlogiaChartsLib')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'joda-time:joda-time:2.9.1'
compile 'com.github.alamkanak:android-week-view:1.2.6'
}
I don't know how but android studio keeps calling the SDK 23, although I already deleted from SDK manager and I only have the 22. Why is it giving this error?
Recently I updated my studio to 2.0, along with several other build-tools, library updates.
Since then, I keep getting these two errors -
Error:(25, 13) Failed to resolve: com.android.support:design:22.0.1
Install Repository and sync project<br>
Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:22.0.1
Install Repository and sync project<br>
I have searched SO and the web for possible solutions and have tried resolving using API 21, API 22 and API 23 versions of the same appcompat and design repository.
This is my gradle file for the API 22 version -
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.0.1'
compile 'com.android.support:design:22.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
}
Please note that I have the Android Support Repository and Support library updated to their latest versions.
My SDK manager:
For reference, I have tried the solutions in these posts:
Android Studio-Failed to resolve:com.android.support:appcompat-v7.22.2.0
Android appcompat v7:23
failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2
Couldn't compile android studio project
Well, I resolved the problem by changing the version of the appcompat-v7 and design repositories to 22.0.1 from 22.2.1. 22.0.1 is not a valid dependency version.
In my gradle file ->
compile 'com.android.support:appcompat-v7:22.0.1'
compile 'com.android.support:design:22.0.1'
Changed this to
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
Click Install Repository and sync project and continue install.
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.