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
Related
I want to change my compileSdkVersion from 23 to 21.
My problem is that I do not know, how should I do it and I take the following error :
Please guide me.
Thanks.
compile 'com.android.support:design:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compileSdkVersion and support libraries version should have always the same major version value.
If you downgrade compileSdkVersion to API 21 you should downgrade your support libraries version to 21.0.3.
if you have: "Install Repository and sync project" error, you should upgrade the Android Support Repository from Android Studio following the official guide here as the image below.
Change some lines as following:
compileSdkVersion 21
buildToolsVersion "21.0.3"
compile 'com.android.support:design:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:suppoert-v4:21.0.3'
if still red lines appears & showing error, then you need to install appropriate repositories or build tools.
I can't install Android SDK Tools on Android Studio (version 2.3).
I got the following error,
Is there anyway I can solve this error?
TLDR; no.
Google, for whatever reason, has decided to remove direct access to the standalone SDK Manager starting with Android STudio v2.3.
If you run SDK manager directly using #iK2H 's instructions, you will see that SDK manager does not detect Android SDK Tools v25.3.1.
It could be that v25.3.1 is only available via Android Studio settings, but this is broken for now.
Your best best is to upvote this issue to draw attention to Google to fix it.
Open the terminal
$ cd "sdk path"/tools
$ ./android
Update
Google fixed this, on the server side, shortly after discovery. It should work now.
File -> Invalidate Caches / Restart
or
Build -> Clean Project can help (let me know if it did)
From Windows, search for SDK Manager and right click to 'run as administrator'. Attempt to the install it from there.
Was having the same issue and that worked for me...
Ok, I think I found the solution. Please try it out and report back on comments. Build is a success, but I still need to test by app to check for features and other possible side effects. Did not want everyone to wait until this is resolved. If this does not work or has serious issues, I am happy to delete this answer.
PLEASE COMMENT
The solution
I commented out
compile 'com.google.android.gms:play-services:x.y.z'
I also removed
com.google.android.gms:play-services-appindexing
com.google.android.gms:play-services-contextmanager
Upgraded the remaining com.google.android.gms:* services to 10.2.0
This is my working build.gradle with no errors
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled = true
}
def applicationVersion = '*****'
dexOptions {
// incremental = true; // If anybody use below 2.2.2 android studio then please uncomment this line. It's by default true.
preDexLibraries = false
javaMaxHeapSize "2g"
}
signingConfigs {
....
}
buildTypes {
...
}
productFlavors {
...
}
packagingOptions {
...
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:25.1.1'
// compile 'com.google.code.gson:gson:2.2.4'
compile 'com.fasterxml.jackson.core:jackson-core:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.crittercism:crittercism-android-agent:+'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.android.gms:play-services-base:10.2.0'
// compile 'com.google.android.gms:play-services-appindexing:10.2.0'
// compile 'com.google.android.gms:play-services-contextmanager:10.2.0'
compile 'com.google.android.gms:play-services-places:10.2.0'
compile 'com.google.android.gms:play-services-nearby:10.2.0'
compile 'com.google.android.gms:play-services-maps:10.2.0'
// compile 'com.google.android.gms:play-services-ads:10.2.0'
// compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
// compile 'com.google.android.gms:play-services-awareness:10.2.0'
// compile 'com.google.android.gms:play-services-cast:10.2.0'
// compile 'com.google.android.gms:play-services-plus:10.2.0'
compile 'com.google.maps.android:android-maps-utils:0.4.+'
compile 'com.google.zxing:core:3.2.0'
compile 'com.journeyapps:zxing-android-embedded:3.3.0#aar'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-analytics:10.2.0'
compile 'com.flurry.android:analytics:6.4.2'
....
}
apply plugin: 'com.google.gms.google-services'
Update your SDK tools from old "SDK Manager" UI (You can find it at <your SDK>/tools/android) to 25.2.5 then update it from Android Studio to latest version (26.1.1).
For some reasons you can't see newer versions in SDK Manager UI.
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
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.