I am trying to share a photo from my application to facebook. I have added the Facebook SDK and done the initial setup. But when I run the application its crashing and I am getting the following exception.
Here is my logcat:
java.lang.RuntimeException: Unable to get provider com.facebook.internal.FacebookInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.internal.FacebookInitProvider" on path: DexPathList[[zip file "/data/app/com.ignite.a01hw909350.kolamdemo-2/base.apk", zip file "/data/app/com.ignite.a01hw909350.kolamdemo-2/split_lib_slice_1_apk.apk"],nativeLibraryDirectories=[/data/app/com.ignite.a01hw909350.kolamdemo-2/lib/arm64, /data/app/com.ignite.a01hw909350.kolamdemo-2/base.apk!/lib/arm64-v8a, /data/app/com.ignite.a01hw909350.kolamdemo-2/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5267)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4859)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4799)
at android.app.ActivityThread.access$1600(ActivityThread.java:168)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5609)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.internal.FacebookInitProvider" on path: DexPathList[[zip file "/data/app/com.ignite.a01hw909350.kolamdemo-2/base.apk", zip file "/data/app/com.ignite.a01hw909350.kolamdemo-2/split_lib_slice_1_apk.apk"],nativeLibraryDirectories=[/data/app/com.ignite.a01hw909350.kolamdemo-2/lib/arm64, /data/app/com.ignite.a01hw909350.kolamdemo-2/base.apk!/lib/arm64-v8a, /data/app/com.ignite.a01hw909350.kolamdemo-2/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.ActivityThread.installProvider(ActivityThread.java:5252)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4859)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4799)
at android.app.ActivityThread.access$1600(ActivityThread.java:168)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5609)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Suppressed: java.lang.ClassNotFoundException: com.facebook.internal.FacebookInitProvider
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Here is my Manifest.xml
<application
android:name=".AppController"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<activity android:name=".MainActivity" />
<activity
android:name=".ARCameraActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="fullSensor" />
<activity
android:name=".RegistrationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".LoginActivity"
android:screenOrientation="portrait" />
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MenuActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ScanAndDrawActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GalleryActivity"
android:screenOrientation="portrait" />
<activity
android:name=".PdfKolamActivity"
android:screenOrientation="portrait" />
<service
android:name=".BluetoothService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.ignite.a01hw909350.kolamdemo.BluetoothService" />
</intent-filter>
</service>
<receiver
android:name=".MyScheduleReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
</intent-filter>
</receiver>
<activity
android:name=".BotDialogActivity"
android:launchMode="singleInstance"
android:noHistory="true"
android:theme="#style/Theme.AppCompat.Light.Translucent" />
<activity android:name=".ModelActivity" />
<activity android:name=".PanchangActivity" />
<receiver
android:name=".MyStartServiceReceiver" android:exported="true"/>
<service
android:name=".services.AlarmService"
android:enabled="true">
<intent-filter>
<action android:name="NOTIFICATION_SERVICE" />
</intent-filter>
</service>
<receiver
android:name=".BootReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<provider android:authorities="com.facebook.app.FacebookContentProvider43234236033829"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
</application>
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.ignite.a01hw909350.kolamdemo"
minSdkVersion 17
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'
}
}
aaptOptions {
noCompress 'KARMarker'
noCompress 'armodel'
}
repositories {
jcenter()
maven()
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':KudanAR1')
compile project(':eventbus-3.0.0')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.scottyab:secure-preferences-lib:0.1.4'
compile 'com.jrummyapps:animated-svg-view:1.0.1'
compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
compile 'io.palaima:smoothbluetooth:0.1.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.afollestad.material-dialogs:core:0.9.3.0'
compile 'com.flurgle:camerakit:0.9.13'
compile 'com.github.zhukic:sectioned-recyclerview:1.0.0'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:25.3.1'
compile 'com.github.barteksc:android-pdf-viewer:2.4.0'
compile 'org.rajawali3d:rajawali:1.1.668#aar'
compile 'com.tapadoo.android:alerter:1.0.8'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
testCompile 'junit:junit:4.12'
}
Where is the problem coming from?
I had the same error because a badly set multidex. The problem occurred on device with Android 4.4.2.
This i had in build.gradle:
defaultConfig {
multiDexEnabled true
}
And I had to add to build.gradle:
dependencies {
compile 'com.android.support:multidex:1.0.2'
}
And this method to my application class:
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Answer is originaly from here, which problem I had to solve when I avoided facebook problem by removing facebook SDK. So maybe can help another tip from there.
Try to change your facebook-sdk version to the latest (now it is 4.24.0):
compile 'com.facebook.android:facebook-android-sdk:4.24.0'
Update your google play services 11.0.2
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
This fixed this problem for me.
Make sure gradle is not running in offline work mode, otherwise it will not download sdk from repositories.
Make gradle work online with steps below:
1 - Open the Preferences window by clicking File > Settings
2 - In the left pane, click Build, Execution, Deployment > Gradle
3 - Uncheck the Offline work checkbox
4 - Click OK
Just try Clean Project & Rebuild Project.
Related
I tried using the Glide library in order to load a profile picture from Facebook, in the gradle I implemented the 4.8.0 version (which is not the latest) and it made this error :
ERROR: Failed to parse XML in C:\Users\Paul Jouet\Desktop\ESILV\S5\Mobile Programming\ProjetTest2\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[18,89]
Message: expected start or end tag
Affected Modules: app
My manifest module has disappeared, it is still in my project and I can open it, but not from the 'android' section... When I tried syncing again without the implementation, the error remains, I tried some solutions I found like cleaning the project and rebuild it, but none worked.
This is how the 'android' section looks like after the failed syncing, the module 'manifest' is missing even though it is still in the same location as before
Can someone explain to me how this can happen ? It makes no sense to me since I obviously deleted the part causing the problem... The only solution I could find is to recreate a project from scratch and copy paste all my code, but this is not viable since it can happen again.
Thank you for helping !
Edit : here are my manifest and gradle codes
Gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.projettest2"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.facebook.android:facebook-android-sdk:4.42.0'
implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
}
}
Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.projettest2">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:authorities="com.facebook.app.FacebookContentProvider464643414180175" //I changed the ID
android:name="com.facebook.FacebookContentProvider"
android:exported="false" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
</application>
</manifest>
I had this problem before where my app wouldn't work because of the ClassNotFoundException. To fix that I created a new project and it worked for a while, until some changes in again caused this error to come up again. I noticed the debug apk was very small about 980 kilobytes in size, usually it's supposed to be around 2 megabytes. I fixed it by removing minifyEnabled true under debug in the app's gradle file. The debug apk size was back to normal and was working again until I added a library which caused the error to come up again. The debug apk's size got reduced back to 980 kilobytes. I have cleaned, rebuilt after deleting the .gradle folder and build folder inside the app folder, still this problem persists.
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
applicationId "com.prajjwal.myfreight"
minSdkVersion 16
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'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:25.4.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.rengwuxian.materialedittext:library:2.0.3'
compile files('libs/jtds-1.2.8-a46da18a7c06f34fb19c38538665cbe1.jar')
}
The gradle version I'm using is 4.1.
Stacktrace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.prajjwal.myfreight, PID: 27367
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.prajjwal.myfreight/com.prajjwal.myfreight.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.prajjwal.myfreight.SplashActivity" on path: DexPathList[[zip file "/data/app/com.prajjwal.myfreight-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2486)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2656)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1512)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5692)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.prajjwal.myfreight.SplashActivity" on path: DexPathList[[zip file "/data/app/com.prajjwal.myfreight-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1074)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2463)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2656)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1512)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5692)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
Suppressed: java.lang.ClassNotFoundException: com.prajjwal.myfreight.SplashActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name="com.prajjwal.myfreight.SplashActivity"
android:label="#string/title_activity_splash"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.prajjwal.myfreight.InternationalActivity"
android:label="#string/title_activity_exp"
android:theme="#style/AppTheme">
</activity>
<activity android:name="com.prajjwal.myfreight.LocationActivity"
android:label="#string/title_activity_location"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.List"
android:label="#string/title_activity_list"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.QueryActivity"
android:label="#string/title_activity_query"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.Query2Activity"
android:label="#string/title_activity_query2"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.Origin"
android:label="#string/title_activity_origin"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.Destination"
android:label="#string/title_activity_destination"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.LoginActivity"
android:label="#string/title_activity_login"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.QuoteDetails"
android:label="#string/title_activity_quote_details"
android:theme="#style/AppTheme"> </activity>
<activity android:name="com.prajjwal.myfreight.SignUpActivity"
android:label="#string/title_activity_sign_up"
android:theme="#style/AppTheme"> </activity>
</application>
I have the following error when I has converted the Android Build Tools Version to 26.0.0 and add the metadata for:
Facebook .
Fabric.
compile 'com.google.android.gms:play-services:11.0.4'
The Error Is :
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed with multiple errors, see logs
My Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="moments.com.arabsooq"
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature
android:name="android.hardware.camera" android:required="true" />
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="#mipmap/ic_launcherr"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcherr"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".activities.SplashScreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity"
android:label="#string/title_activity_main"
android:screenOrientation="portrait"
android:theme="#style/AppTheme">
<intent-filter android:label="#string/app_name_ar">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.arabsoog.com"
android:pathPrefix="/create"
android:scheme="http" />
</intent-filter>
</activity>
<activity
android:name=".activities.ChooseCountry"
android:screenOrientation="portrait" />
<activity
android:name=".activities.LoginChooser"
android:screenOrientation="portrait" />
<activity
android:name=".activities.SubCategory"
android:screenOrientation="portrait" />
<activity
android:name=".activities.Advertisments"
android:screenOrientation="portrait" />
<activity
android:name=".activities.ProductAct"
android:screenOrientation="portrait" />
<activity
android:name=".activities.AddAd"
android:screenOrientation="portrait" />
<activity
android:name=".activities.Search"
android:label="#string/title_activity_search"
android:screenOrientation="portrait"
android:theme="#style/AppTheme" />
<activity
android:name=".activities.DoneAdd"
android:screenOrientation="portrait"
android:theme="#style/MyAlertDialogStyle" />
<activity
android:name=".activities.MyProfile"
android:label="#string/title_activity_my_profile"
android:screenOrientation="portrait" />
<activity
android:name=".activities.SearchResult"
android:screenOrientation="portrait" />
<activity
android:name=".activities.MyFave"
android:screenOrientation="portrait" />
<activity
android:name=".activities.UpdateAdd"
android:screenOrientation="portrait" />
<activity
android:name=".activities.AboutApp"
android:screenOrientation="portrait"
android:theme="#style/MyAlertDialogStyle" />
<activity
android:name=".activities.Contact_User"
android:screenOrientation="portrait"
android:theme="#style/MyAlertDialogStyle" />
<activity
android:name=".activities.MyAds"
android:label="#string/title_activity_my_ads"
android:theme="#style/AppTheme" />
<service
android:name=".services.MyFirebaseInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name=".services.MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<meta-data
tools:replace="android:value=25.3.1"
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name=".activities.Zoom"
android:theme="#style/MyAlertDialogStyle" />
<meta-data
android:name="io.fabric.ApiKey"
android:value="83b5fdfbb15ad6f9567027ae5a20c3fe99e2cedf" />
</application>
</manifest>
My Gradle :
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.24.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "moments.com.arabsooq"
minSdkVersion 17
targetSdkVersion 26
versionCode 23
versionName "0.0.14"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6#aar') {
transitive = true;
}
compile 'org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.3'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.tasomaniac:delayed-progress:0.4'
compile 'com.taishi-y:flipprogressdialog:0.1.0'
compile 'net.gotev:uploadservice:3.2.4'
compile 'net.gotev:uploadservice-okhttp:3.2.4'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'xyz.dev_juyoung:cropicker:1.0.3'
compile 'com.reginald.swiperefresh:library:1.1.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.daimajia.easing:library:2.0#aar'
compile 'com.daimajia.androidanimations:library:2.3#aar'
compile 'com.nispok:snackbar:2.6.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.firebase:firebase-crash:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.firebase:firebase-ads:11.0.4'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.android.gms:play-services:11.0.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
crashlytics {
enableNdk true
androidNdkOut 'src/main/obj'
androidNdkLibsOut 'src/main/libs'
}
Error Log :
2017-08-21 10:45:47,158 [61689741] DEBUG - com.crashlytics - Frame
activated for project: Project
'G:\ArabSoog\ArabSoog\ArabSooqApplication' ArabSooqApplication
2017-08-21 10:45:49,204 [61691787] INFO -
ild.invoker.GradleBuildInvoker - About to execute Gradle tasks:
[clean, :app:generateDebugSources,
:app:generateDebugAndroidTestSources, :app:mockableAndroidJar,
:app:prepareDebugUnitTestDependencies]
2017-08-21 10:45:49,210 [61691793] INFO -
s.plugins.gradle.GradleManager - Instructing gradle to use java from
C:/Program Files/Android/Android Studio/jre
2017-08-21 10:45:49,273 [61691856] INFO -
ild.invoker.GradleBuildInvoker - Build command line options:
[--configure-on-demand, -Pandroid.injected.invoked.from.ide=true,
-Pandroid.injected.generateSourcesOnly=true, --init-script, C:\Users\HAMZAA~1\AppData\Local\Temp\asLocalRepo4354.gradle]
2017-08-21 10:45:49,273 [61691856] INFO -
xecution.GradleExecutionHelper - Passing command-line args to Gradle
Tooling API: [--configure-on-demand,
-Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.generateSourcesOnly=true, --init-script, C:\Users\HAMZAA~1\AppData\Local\Temp\asLocalRepo4354.gradle]
2017-08-21 10:45:50,510 [61693093] INFO -
pl.ProjectRootManagerComponent - project roots have changed
2017-08-21 10:45:50,594 [61693177] INFO -
.diagnostic.PerformanceWatcher - Pushing properties took 3ms; general
responsiveness: ok; EDT responsiveness: ok
2017-08-21 10:45:50,610 [61693193] INFO -
.diagnostic.PerformanceWatcher - Indexable file iteration took 16ms;
general responsiveness: ok; EDT responsiveness: ok
2017-08-21 10:45:50,610 [61693193] INFO -
indexing.UnindexedFilesUpdater - Unindexed files update started: 2
files to update
2017-08-21 10:45:50,687 [61693270] INFO -
.diagnostic.PerformanceWatcher - Unindexed files update took 77ms;
general responsiveness: ok; EDT responsiveness: ok
I was removed this line from Manifest:
tools:replace="android:value=25.3.1"
and using this code in build.gradle
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
using this resourse :
Comments
I have read carefully: https://developer.android.com/studio/build/multidex.html#mdex-gradle
So I have added to my build.gradle:
compile 'com.android.support:multidex:1.0.1'
My application definition in Android.manifest:
android:name=".App"
Finally, App class is defined as follows:
public class App extends Application
{
private static Context mContext;
#Override
protected void attachBaseContext(Context base)
{
super.attachBaseContext(base);
MultiDex.install(this);
}
#Override
public void onCreate()
{
super.onCreate();
mContext = this;
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.defaultDisplayImageOptions(new DisplayImageOptions.Builder()
.imageScaleType(ImageScaleType.EXACTLY)
.build())
.build();
ImageLoader.getInstance().init(config);
}
public static Context getContext()
{
return mContext;
}
}
Unfortunately, this definitely don't help. My app still crashes on KitKat, with following message:
java.lang.RuntimeException: Unable to instantiate application
com.example.App: java.lang.ClassNotFoundException: Didn't find class
"com.example.App"
I did everything suggested by Google. Also tried to extend MultiDexApplication, still the same.
Do you have any ideas what else can I try?
[edit]
My build.gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
general {
keyAlias 'key'
keyPassword '123abc'
storeFile file('../store.jks')
storePassword '123abc'
}
}
compileSdkVersion 25
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "(removed)"
minSdkVersion 19
targetSdkVersion 25
dataBinding.enabled = true
multiDexEnabled = true
versionCode 21
versionName '2.2'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
incremental true
targetCompatibility 1.8
sourceCompatibility 1.8
}
dexOptions {
javaMaxHeapSize '4096m'
}
lintOptions {
tasks.lint.enabled = false
}
productFlavors {
general {
applicationId "(removed)"
signingConfig signingConfigs.general
}
lomza {
applicationId "(removed)"
signingConfig signingConfigs.general
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:customtabs:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.yarolegovich:lovely-dialog:1.0.5'
compile 'com.kaopiz:kprogresshud:1.0.5'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-places:10.2.1'
compile 'com.github.jaydeepw:poly-picker:v1.0.22'
compile 'com.android.support:support-v13:25.4.0'
compile 'gun0912.ted:tedpermission:1.0.3'
compile 'io.tus.android.client:tus-android-client:0.1.4'
compile 'io.tus.java.client:tus-java-client:0.3.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-vector-drawable:25.4.0'
compile 'com.google.firebase:firebase-crash:10.2.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'org.greenrobot:eventbus:3.0.0'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.google.guava:guava-collections:r03'
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.hendraanggrian:collapsingtoolbarlayout-subtitle:0.7.0'
compile 'io.reactivex.rxjava2:rxjava:2.0.2'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
Android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="(removed)">
<uses-feature android:name="android.hardware.camera"/>
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:fullBackupContent="#xml/backup_descriptor">
<!-- [START fcm_default_icon] -->
<!--
Set custom default icon. This is used when no icon is set for incoming notification messages.
-->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#mipmap/ic_launcher"/>
<!--
Set color used with incoming notification messages. This is used when no color is set for the incoming
notification message.
-->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="#color/colorAccent"/>
<!-- [END fcm_default_icon] -->
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity
android:name=".SplashActivity"
android:label="#string/app_name"
android:noHistory="true"
android:theme="#style/Theme.AppCompat.Light.NoActionBar.FullScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="SHOW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
</activity>
<activity
android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:launchMode="singleTop"
android:theme="#style/AppTheme.NoActionBar">
</activity>
<activity android:name=".LoginActivity">
<!-- android:noHistory="true" -->
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="(removed)"/>
<activity
android:name=".DetailsActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/activity_details"
android:launchMode="singleTop"
android:parentActivityName=".MainActivity">
</activity>
<activity
android:name=".MapActivity"
android:label="#string/activity_map"
android:parentActivityName=".DetailsActivity">
</activity>
<activity
android:name=".AddEventActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/activity_add_event"
android:launchMode="singleTop"
android:parentActivityName=".MainActivity">
</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"/>
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="#string/fb_login_protocol_scheme"/>
</intent-filter>
</activity>
<service
android:name=".Tus.TusUploadService"
android:exported="false"/>
<!-- [START firebase_service] -->
<service android:name=".Firebase.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<!-- [END firebase_service] -->
<!-- [START firebase_iid_service] -->
<service android:name=".Firebase.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<!-- [END firebase_iid_service] -->
<activity
android:name=".Preferences.SettingsActivity"
android:label="#string/title_activity_settings"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="(removed).MainActivity"/>
</activity>
<activity
android:name="nl.changer.polypicker.ImagePickerActivity"
android:label = "#string/activity_img_picker_title"
/>
<activity
android:name=".ImagePreviewActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_image_preview"
android:parentActivityName=".DetailsActivity"
android:theme="#style/FullscreenTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="(removed).DetailsActivity"/>
</activity>
</application>
</manifest>
disables Instant Run.
Note :-> If your project is configured for multidex with minSdkVersion 20 or lower, and you deploy to target devices running Android 4.4 (API level 20) or lower, Android Studio disables Instant Run.
read more from doc
enable multidex as following:
android {
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
create one class like this
public class Multi_Dex extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
now in your manifiest file add this
<application
android:name=".Multi_Dex"
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
First of all I know there are many similar question, but my case is different. Please read the full question first!
This is the full error...
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/appindexing/Action$Builder$StatusType.class
Whenever I am trying to run in my emulator this error is showing.
Also if I try to generate .apk file (in debug or released mode), the same error is showing.
Now the magic...
If I run in my mobile phone in debug mode, it is totally ok. No errors are showing, it is running fine.
This is my manifest file...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.brandtechnosolutions.petbaazar">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#drawable/iconpetbazar"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity android:name=".WebActivity" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:screenOrientation="portrait" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<activity
android:name=".BuyerSellerActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".OptionActivity"
android:label="#string/title_activity_option"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".TakeAdInfoActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"/>
</application>
</manifest>
My build.gradle...
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
dexOptions {
javaMaxHeapSize "1g"
}
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.brandtechnosolutions.petbaazar"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// apply plugin: 'com.google.gms.google-services'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-v4:25.1.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'junit:junit:4.12'
}
Using sdk platforms...
Gingerbread, Honeycomb, Marshmallow
Using emulator with Jelly Bean.
Anybody has any idea how to solve it, please help!
You should use the same level of libraries:
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-appindexing:10.0.1'
Also add at the buttom of the file:
apply plugin: 'com.google.gms.google-services'
EDIT:
To use the plugin you have to add the dependency in the buildscript block (in your top-level file or module file):
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
// ...
}