I moved my SDK directory from my laptop to a remote hard drive. Afterward, I noticed Android Studio can't find
com.google.api.client.extensions.android (see below)
The app compiles fine and runs fines which makes it more perplexing....
Did anyone have the similar experience? If so, what's the resolution.
Apparently, there was a conflict in the google.android library.
I added force = true to a handful of libraries and the problem was resolved. Below is a sample of what I did:
compile ('com.android.support:appcompat-v7:26.1.0'){
force = true
}
compile ('com.android.support:design:26.1.0'){
force = true
}
// For enabling Google app invite
compile ('com.google.firebase:firebase-invites:11.4.2')
compile 'com.google.android.gms:play-services-plus:11.4.2'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.android.gms:play-services-identity:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-gcm:11.4.2'
compile 'com.facebook.android:facebook-android-sdk:4.27.0'
Related
After having started using Firebase for event logging in my android app I keep getting these error messages when I fire up my app:
E/System: java.lang.IllegalStateException: The database '/...folder here.../google_app_measurement_local.db' is not open.
at android.database.sqlite.SQLiteDatabase.throwIfNotOpenLocked(SQLiteDatabase.java:2169)
at android.database.sqlite.SQLiteDatabase.createSession(SQLiteDatabase.java:365)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:84)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:83)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.database.sqlite.SQLiteDatabase.getThreadSession(SQLiteDatabase.java:359)
at android.database.sqlite.SQLiteProgram.getSession(SQLiteProgram.java:101)
at android.database.sqlite.SQLiteQuery.setLastStmt(SQLiteQuery.java:96)
at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:111)
at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:300)
at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:366)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:202)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
at java.lang.Thread.run(Thread.java:818)
Here's a snippet from my build.gradle:
dependencies {
compile 'com.android.support:support-v4:25.0.0'
compile 'com.google.firebase:firebase-analytics:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile files('src/main/resources/simple-xml-2.7.jar')
compile files('src/main/resources/date4j.jar')
compile 'com.android.support:appcompat-v7:25.0.0'
compile files('src/main/resources/picasso-2.5.2.jar')
}
All I do is call
_firebaseAnalytics = FirebaseAnalytics.getInstance(context);
and then
_firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, payload);
I have not been able to find any solutions online and am now hoping for help here...
Please move to latest version of firebase SDK. Firebase solved this memory leak issue in their updated sdk. Remove your old SDK and add below line in your gradle file.
compile 'com.google.firebase:firebase-core:11.0.1'
I have just faced with this when enabling strictmode, when adding
compile 'com.google.firebase:firebase-core:9.8.0'
I had to use earlier version:
compile 'com.google.firebase:firebase-core:9.6.0'
I've found latest version from Firebase Android SDK Release Notes
After I updated my Support library from 23.1.1 to 23.4.0 I get this warning cannot access android.support.v4.app.baseFragmentActivityEclair on every call to super and every instance of AppCompatActivity
And if I updated my support library to 24.1.1 The warning changes to cannot access android.support.v4.app.baseFragmentActivityJB.
Can anyone tell me why this warning is shown and how can I remove this warning:
here is my dependencies before:
(no error in this)
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityEclairwarning:
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityJBwarning:
compile 'com.android.support:palette-v7:24.1.1'
compile 'com.android.support:gridlayout-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
We ran into a similar problem when one of the packages in our project had dependencies on version 24.0 support libraries and another package was dependent on version 23.4.0. This seems to be a problem for the Android Studio (IntelliJ) IDE, not the compiler, because we were able to build and run the project without any problems. We resolved the warning by reverting the 24.0 dependency to 23.4.0. I suspect that going the other direction (advancing all of our package dependencies to 24.0) would also have eliminated the warning but we didn't experiment with that due to the number of packages in our project.
If you're looking to hack around this, many of the support libraries have an internal library called libs/internal_impl-$VERSION.jar that includes these types of version-specific implementations. To get your IDE to work, you can extract these JARs and manually include them in your IDE's build path.
For example, you can extract the classes referenced here, assuming version 24.2.1, using this command:
unzip support-fragment-24.2.1.aar libs/internal_impl-24.2.1.jar
I have recently added FCM to my project and it's working fine. I have used
compile 'com.google.firebase:firebase-messaging:9.0.2'
this line for the library since messaging service is only required. But when I have seen the external libraries dir there are many firebase classes which have no use in my app. Please see the image below.
Edited : Here is the whole dependency clause
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
}
apply plugin: 'com.google.gms.google-services'
You are including more libraries than you need because you are using the general play-services library and not using the split libraries like play-services-drive or some other specific library.
By using play-services:9.0.2 you are saying you want to include all libraries in Google Play services including all the Firebase ones.
Removing the play-services:9.0.2 dependency and replacing it with a specific one like play-services-drive:9.0.2 (depending on what APIs you want to use) should fix your issue.
I believe since you don't add the core lib dependency explicity. The messaging dependency downloads all of the Firebase one.
Try adding the core and messaging both to limit the things to messaging part
compile 'com.google.firebase:firebase-core:9.0.1'
compile 'com.google.firebase:firebase-messaging:9.0.1'
I have update the google play service version to 7.+, this version is required for GoogleApiClient, After updating google play version when i run project it will take much time and stuck entire computer.
Please guide.
thanks
Make sure to use required Google API in project. What you need in your project.
dependencies {
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-base:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
}
Note: Do not use complete google dependencies
dependencies {
compile 'com.google.android.gms:play-services:8.3.0'
}
This is a really strange problem and I've been days stuck with it: we've got a working project (no errors whatsoever) in a git repository. Everything is OK (it's even published in Google Play) when executing the project from the creator's equip, but, when we try to clone it in a different equip (we've tried Mac, Linux and Windows), this exception is thrown:
Unable to execute dex: method ID not in [0, 0xffff]: 65536
Hereafter, even if we apply the multidex solution as described in Android Developers or delete the unused dependencies, the app raises an exception when trying to load class android.support.design.widget.NavigationView (coming from a NoClassDefFound in runtime).
I suspect maybe it has something to do with the gradle plugin or appcompat libs version, but so far, nothing we've tried has worked.
Edit: This is not a common multiDex error, I'm pretty familiarized about how to solve them, it's about one computer executing the app without problems but when you clone the same project from git in other computer, it won't run and the MultiDex error is thrown.
EDIT 2: mi dependenvy list is as follows (I ommit the company libs but they're not the problem
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.mo2o.third:valnif:1.0.0'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile('com.afollestad.material-dialogs:core:0.8.0.1#aar') {
transitive = true
}
compile 'com.android.support:percent:23.0.0'
compile 'se.emilsjolander:stickylistheaders:2.6.0'
compile 'me.grantland:autofittextview:0.2.+'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile "com.google.android.gms:play-services-gcm:8.3.0"
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'