Unable to load class 'com.google.gson.JsonObject' - java

I am trying to include firebase SDK in my Android Studio Project. But it giving me an error. I am using latest JDK version (1.7.0_71) and it is asking for upgrading higher version to (1.7.0_67).
I need help for basic firebase setup SDK on android. I tried to setup it by the reference of following link: https://firebase.google.com/docs/android/setup#add_the_sdk.
I am getting following error: Please check attached screenshot

I had the same problem trying to GCM to an old android project.
The solution for me was to also add
classpath 'com.android.tools.build:gradle:2.1.2'
to the top-level build file dependencies, just before classpath 'com.google.gms:google-services:3.0.0'. For the old android project, this dependency only existed in the module-level build file.

Make sure you are using Android Studio 1.5 or above. Just saw a guy who had the same issue and he was using android studio 1.0.1
Updating the Android Studio will fix it for you. Also check other pre-requisites.
Prerequisites from official documentation are as follows:
A device running Android 2.3 (Gingerbread) or newer, and Google Play services 9.2.1 or newer
The Google Play services SDK from the Android SDK Manager
Android Studio 1.5 or higher
An Android Studio project and its package name

First of all complete all the steps mentioned in a link you had followed for Firebase
And note that it requires active internet connection so please check internet connection and add both project and app level dependencies as per suggested in link of Firebase you had used in question
Also it is best to use JDK version 1.8 and above because oracle officialy ended support for those versions. If you are working with Firebase Api which is quiet new so i would highly recommend as it is also recommended by most professionals including developers at Google.Or if you want to go with JDK 1.7 then update it to latest Jdk 7u80 or 7u79 at least because it has least issues comparing to older versions.
The best solution is use JDK version 1.8 and follow all the steps in link https://firebase.google.com/docs/android/setup#add_the_sdk

Ensure that you have the google-services.json file, with the client id: <effective package name>, in the app directory. This you download from the Firebase console when you add an app.

Related

Error when importing file from Codelabs tutorial

I'm trying to use a CodeLab tutorial for adding Chromecast support. I've downloaded the files and when I try to import them into Android Studio I get this error:
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
I'm using the latest version of Android Studio and latest tool build and Gradle. What can I try to fix this error?
I managed to figure this out. It ended up being because the Codelab application used in the tutorial was so old and outdated I needed to change a few things in the Gradle and manifest.
In the Gradle file I changed the build tools to a later version
classpath 'com.android.tools.build:gradle:3.2.1'
I updated the compiled version to 28 plus updated the support libraries. I also had to remove the unique app id and remove the target sdk from in manifest. Finally I updated the wrapper settings, and it started to work correctly.

How to update to the latest version of Android Support Library in Eclipse?

I'm trying to import a project into Eclipse and I'm getting the errors:
The import android.support.v7.widget.Toolbar cannot be resolved The
project was not built since its build path is incomplete. Cannot find
the class file for
android.support.v4.app.ActionBarDrawerToggle$DelegateProvider
I found this answer from other question -Why the import android.support.v7.widget.Toolbar cannot be resolved in my project
So it seems to be a problem with the Android Support Library. But when I try to update mine it only has version 20 available. The other answer said they were able to upgrade their version but I don't seem to have that option. How to do get the latest version of the Support Library?
How to do get the latest version of the Support Library?
As you can check in official documentation:
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager.
It means that SDK Manager and the sdk\extras\android folder will not contain the latest support libraries.
Just migrate to Android Studio.

Eclipse ADT not generating MainActivity

I am having an immensely frustrating issue with Eclipse and the ADT after updating all the SDK's, API's and Support Libraries for Android this week.
Ever since updating everything I am unable to properly create an Android Project in Eclipse. It does not generate the MainActivity.java or the main_layout.xml files at all. I have read through most of the other posts regarding this and the fixes they suggest don't seem to work. I have tried looking for the updated software by going to:
Help --> Check for updates (Everything is up-to-date).
I have also tried the manual way by going to:
Help --> Install New Software and inputting https://dl-ssl.google.com/android/eclipse/
It still says I have the latest version of the ADT.
I have also tried reinstalling the ADT plugin as well, but to not avail.
Trying to create an Activity after project creation also does not work.
Versions of software that I am running:
Android SDK Tools 24.0.1
Android API 1.5 up to and including API 5.0.1
Eclipse: Luna Service Release 1(4.4.1)
ADT Plugin Not sure
Thank you for taking the time to read this.
The ADT and SDK Tools must be compatible. The latest ADT version is "ADT 23.0.4". And the corresponding SDK Tools version is 23.0.5. You have updated your SDK Tools version to 24.0.1, but there are no ADT version can support. So you should roolback to the SDK Tool version 23.0.5.
Here is the link:
https://dl-ssl.google.com/android/repository/tools_r23.0.5-windows.zip
Add an Empty Activity, instead of Blank Activity. This will generate MainActivity.java
What is your Java version? You didn't mention about it. Please check it, it should be Java 7 for Android 5.0. If you have Java 7 then check eclipse.ini file. If it refers to Java 6 then change here also to Java 7.
Google fixed this issue and below link may help you.
https://code.google.com/p/android/issues/detail?id=82393

RegisterActivity: cannot be resolved to a type, AppEngine

I have set up my computer with windows 8.1 completely new (formatted), to be sure to have a working system.
I have installed Eclipse and the plugins the following way:
download and unpack eclipse Kepler
install JDK
install android SDK
install android SDK-plugins in eclipse
in android sdk: install all extras, API 19, in tools: Android SDK Tools, Android SDK-Platform Tools, Android SDK Build Tools (only newest, 19.0.3)
install all google plugins for kepler(Google App Engine Tools for Android, Google Plugin for eclipse, GWT Designer for GPE, SDKs)
Now, is everything set up correctly, to use google app engine correctly?
When I create a new app engine connected android project, google creates a bugged project.
I have 50 errors, of which 49 can be resolved by changing the Java version from 1.4 to 1.7 in the app engine project (Properties: Java Compiler and Project Facet)
However in the non-appengine project, in the MainActivity I get following error:
RegisterActivity cannot be resolved to a type.
How to solve this? I did not do anything by myself yet, I only created a project and I already have an error...
You are very thorough, which is good. Your development installation appears to have flaws, and you might be trying to make it run before you have seen it walk. You need to divide and conquer the potential problems. Initially simplify what you aim to create.
To pinpoint the errors, try the two standard tutorials before starting on your own design: first build and deploy an AppEngine project without Android components, and only after that works, build and deploy an Android to AppEngine project. Somewhere along that process your errors will show up, and then you should have a more specific piece of source code to show and discuss in this question.
Yesterday, a new version of Android SDK (22.6.2) was released. Apparently, the problem with RegisterActivity was solved in this update. Now I can create an Appengine connected Android Project without any errors!

Cannot create android application using eclipse

NOTE: I have already fixed this problem. I used the methods described in a previous question/answer discussion. Thank you for whoever tagged this as previously answered!
It an be found here: ADT 22.2 New App Wizard: Unsupported template dependency: Upgrade your Android Eclipse plugin
Today I just downloaded and installed Eclipse via the developer.android.com tutorials. I had almost initiated my first Android Application when I came across this error:
I don't understand the error. It does not specify a required version, and my version is the most up to date version. Neither the [Install/Upgrade] nor the [Check Again] buttons appear to function. I have also tried to delete and reinstall the Android Support Library via the SDK Manager multiple times.
Can any one help me? Thanks in advance!
Note - I do in fact have both the Android Support Library and Android 4.3 installed:
*Edited to add picture and note*
How did you create your project? Steps: New -> Android Application Project? If you've done this, you should check whether you have installed "Android 4.3" and "Extras->Android Support Library" in Android SDK Manager.
Go to the Android SDK Manager, then download the required Android version, in your case, version 18 which is Android 4.3.
Right click on the project -> properties -> Android -> select a platform like 4.0
It sounds like you don't have installed android 4.3 sdk(API level 18).
Please open eclipse->windows->android sdk manager and make sure your android 4.3(API 18) status is installed.
Download from http://dl-ssl.google.com/android/repository/tools_r22-windows.zip, unzip it and replace the /tools folder with this one to downgrade the sdk tools. There's a bug in version 22.
Sorry, but someone found that this is a duplicate. I replaced my sdk/tools/templates/activities folder with a more up-to-date one, which resulted in success. The steps and files can be found here:
(ADT 22.2 New App Wizard: Unsupported template dependency: Upgrade your Android Eclipse plugin)
Thank you for all who took time to try and answer my questions. It is much appreciated!

Categories