My app was working fine - then today it wasn't. I'm getting this error and I've tried all of the answers (Except creating a new project and copying over).
Any ideas on what could have happened?
java.lang.RuntimeException: Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.cleanercoding.myapp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
It's like facebook just happened to uninstall itself? Not sure what to do at this point.
Here's my build.gradle file. Not sure if it's even correct:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile files('libs/activation.jar')
compile('com.twitter.sdk.android:twitter:1.12.1#aar') {
transitive = true;
}
compile('com.twitter.sdk.android:tweet-composer:1.0.3#aar') {
transitive = true;
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.cleanercoding.myapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
This happens when you havent initialized the SDK. Make sure it is initialized in your activity to address the issue.
I too got same issue , I solved this issue by changing Facebook version in dependency.
From
compile 'com.facebook.android:facebook-android-sdk:4.14.0' to compile 'com.facebook.android:facebook-android-sdk:4.15.0'
Related
I am trying to import a project in android Studio but if Fails
Following is the project:
project
I get this error:
> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
> Error:(17) Error retrieving parent for item: No resource found that
> matches the given name 'android:TextAppearance.Material.Inverse'.
EDIT:
Below are both gradle files of the project.
build.gradle (Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "net.majorkernelpanic.spydroid"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}
build.gradle(Project: spydroid-ipcamera-master):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
First of all change
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
to compile fileTree(include: ['*.jar'], dir: 'libs')
second try to use the app combat library, cause some resources are missing
compile 'com.android.support:appcompat-v7:25.4.0'
or you can up your compileSdkVersion && targetSdkVersion to 21+
I import related project and chages some thing in build.gradle to last version that recomended by AS.
Change your build.gradle (Module:app) with this and try:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "net.majorkernelpanic.spydroid"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services:11.0.0'
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}
In my case project sync and run perfectly.
UPDATE:
I'll add that you must also change deprecated apache HttpClient with the new HttpURLConnection.
For this purpose add below code to your build.gradle (Module:app) : useLibrary 'org.apache.http.legacy'
I read many posts on this topic, but no one helped me.
I'm using Android Studio and following this guide
This is the project gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
this is the app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.xyv.appname"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
Here you can see where I added google-services.json inside my app:
These are my SDK tools:
Does anybody understand what's my error?
Thank you in advance
You may need to add
compile 'com.google.android.gms:play-services:9.6.1'
in your app build.gradle also. ref: Upgrade to Google Play Services:9.0.0 Error Failed to resolve: com.google.android.gms:play-services-measurement:9.0.0
If you recently bumped the version to 3.0.0 you should doublecheck that you have installed the correct version on your machine in the Android SDK manager.
Open the stand alone SDK Manager, in the Extras section the you will find "Google Play Services" update it .
I resolve my issue by updating android studio to 2.3 beta 2
I did just update an android studio and all is ruining well
Creating an app that has two productFlavors paid and free. Now since I use Google play services for Ads, its giving a very hard time throwing errors one by one, I've been searching on this one for the whole day, and it seems the root cause is the difference in version of play services specified in my gradle.
At the moment, this is the error I obtain:
Error:Execution failed for task
':app:transformClassesWithJarMergingForPaidRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzkb.class
Answers to similar question point to cross check if similar .jars exist. However I tried my best and I am helpless.
This is my app level build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.udacity.gradle.builditbigger"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
free {
applicationId = "com.udacity.gradle.builditbigger.free"
}
paid {
applicationId = "com.udacity.gradle.builditbigger.paid"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Added for AdMob
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.firebase:firebase-ads:9.0.2'
compile project(path: ':backend', configuration: 'android-endpoints')
compile project(path: ':joketeller')
}
apply plugin: 'com.google.gms.google-services'
And this is my top level build.gradle file :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Desperate to fix this, any help will be highly appreciated, Thanks!
hello i want create a android apk.
and need to use from "com.mcxiaoke.volley" and "com.android.support:appcompat"
please give me a build app for my app.
current build app is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
//buildToolsVersion "23.0.2"
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "boxweb.asia.shopcenter"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.volley:volley:1.0.0'
}
but don't work and show error.
error is : http://up.vbiran.ir/uploads/45106145544003944084_Untitled-1.jpg
i can not download "https://jcenter.bintray.com/com/android/volley/volley/1.0.0/volley-1.0.0.pom" in android-studio but can download in browser.
help me to install plugin from file.
please help me
Adding volley support can done just by adding compile 'com.mcxiaoke.volley:library:1.0.19 to gradle.build dependencies module.
dependencies
{
compile 'com.mcxiaoke.volley:library:1.0.19'
}
Go through Android Volley Library
Make sure you have jcenter() in your dependencies. So your build.gradle should have:
repositories {
jcenter()
}
dependencies {
compile 'com.android.volley:volley:1.0.0'
}
Note:
The repositories block can either be in your root build.gradle or your app/build.gradle.
I have tried to import multiple libary for project in android studio.But it always shows error like
For this, I tried multiple solution like sdk update , studio update , build.gradle update and so on.Eventhough, i could not get any result.anyone give solution please.
Herewith I mentioned my gradle sepcification too.
app - build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.abof.android"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:7.5.0'
compile files('libs/volley.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
compile project(':libraries:facebookV2')
compile files('libs/httpcore-4.3-beta1.jar')
compile files('libs/httpmime-4.3.5.jar')
compile project(':libraries:gson-2.2.4')
compile project(':libraries:citruslibrary')
}
project - build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}