the following class could not be instantiated? - android

i was trying to integrate google +1 option in my app.
i imported google play services library in ma app and i did all previous steps like enabling g+ api xml .When i try to add google plus button in xml file,i am getting following error
The following classes could not be instantiated:
- com.google.android.gms.plus.PlusOneButton (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.

I had same problem with TitlePageIndicator.
My reason - wrong class definition in manifest. (Copy/past error during update project).

Related

Codename One Android Build Error - permission#com.android.vending.BILLING

When I'm trying to do an Android build, it's giving me this error:
Merging result: ERROR
/tmp/build6250103586261222869xxx/MyApplication/src/main/AndroidManifest.xml:57:3-64 Error:
Element uses-permission#com.android.vending.BILLING at AndroidManifest.xml:57:3-64 duplicated with element declared at AndroidManifest.xml:56:5-92
/tmp/build6250103586261222869xxx/MyApplication/src/main/AndroidManifest.xml Error:
Validation failed, exiting
This is happening after I've added In App Purchase code, after successfully adding my android.licenseKey to the build hints.
Ah, I had uses-permission android:name="com.android.vending.BILLING" in the build hints. Taking it out fixed the issue. (I believe I had put it there, so that I was able to enable in-app purchase from the google play console).

Getting these three warnings when building my app

I am getting these warnings:
Missing class: com.google.android.gms.common.api.Api$zza
Missing class: com.google.android.gms.internal.zzpm$zza
Missing class: com.google.android.gms.internal.zzqt
1.Clean project
2.Rebuild project.
If you still get issue. Try updating your google play service api in app/module's build.gradle file as this class is inside Google Play Service API.

Facebook native ads error

I'm trying to integrate fb native ads in android but its giving me error every time I try to fetch an ad.
When I log the error its showing error code as -1 and unknown message
I have followed full documentation from https://developers.facebook.com/docs/audience-network/android/nativeadsmanager while integrating but couldn't find any solution
Thanks
May be you are using the wrong dependency. Replace the following dependency (or whatever number you have before :+:
implementation 'com.facebook.android:audience-network-sdk:5.+'
with
implementation 'com.facebook.android:audience-network-sdk:5.0.1'

Android App crash with BaseGameActivity

So, somewhat hard to ask.
I wanna use the google play game service to access a leaderboard for my game.
I tried to use BaseGameActivity like it is shown here Accessing the Games APIs
Tried a few things, did some search but cannot figure out the problem. My App crashes when the BaseGameActivity is started.
Log error shows:
03-10 17:44:54.071: E/AndroidRuntime(31435): FATAL EXCEPTION: main
03-10 17:44:54.071: E/AndroidRuntime(31435): java.lang.IllegalStateException: A
fatal developer error has occurred. Check the logs for further information.
03-10 17:44:54.071: E/AndroidRuntime(31435): at com.google.android.gms.internal.dw$h.b(Unknown Source)
03-10 17:44:54.071: E/AndroidRuntime(31435): at com.google.android.gms.internal.dw$h.b(Unknown Source)
03-10 17:44:54.071: E/AndroidRuntime(31435): at com.google.android.gms.internal.dw$b.bR(Unknown Source)
03-10 17:44:54.071: E/AndroidRuntime(31435): at com.google.android.gms.internal.dw$a.handleMessage(Unknown Source)
Console shows:
[2014-03-10 17:47:18 - BaseGameUtils] Could not find BaseGameUtils.apk!
Answer:
I had to do two metadata entrys about the appid in the manifest.
The Log without filters listed the corresponding errors
The two entries were
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.appstate.APP_ID"
android:value="#string/app_id" />
only one of these entries were mentioned in the tutorial.
I've just finished putting up leaderboards and it was a pain, but I did it and it works. Here's a long list of suggestions that may directly or indirectly help you. I use Eclipse.
For Google Play API, minimum SDK is 9 so put this in your manifest on it's own line:
< uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19"/>
//whatever target you want
Import the BaseGameUtils project to your workspace. You do not have to modify any of this code.
Import google-play-services_lib. This is in your sdk folder. My sdk folder is next to my eclipse folder. Anyways this is in: sdk/extras/google/google_play_services/libproject/google-play-services_lib. You do not have to modify any of this code.
Right Click on YourProject in the package explorer tab (normally on the left side of eclipse with all of your project folders). Then click on Properties (Alt+Enter). Then click on Android. On the bottom part of the Android page, should be "Library." Click the add button and add BaseGameUtils and google-play-services_lib. Do not click "Is Library".
Ensure all of the android-support-v4.jar files in all the relevant projects are using the same up-to-date version. You can update your support file by right clicking your project in the "package explorer" tab and going to ->Android Tools->Add Support Library. Then you accept and update.
You can further check to see if all of the projects listed have this updated jar by right clicking your project and going to properties. Then click on Java Build Path and then Click on the libraries tab. You should see the support jar listed. If not, you can add the jar, where-ever it is located in the project. If you do not do this, you may have something called JAR MIXMATCH. Of course, you will see the exact problem in your console so this is easy to fix and diagnose.
Your manifest should be:
< meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
< meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
The last line with #integer looks into the google_play_services_version so you don't have to do anything in the future whenever the google play version changes. Do not hard code the version number value or you will have to manually update it often.
MyProject extends BaseGameActivity.
Then to call the leaderboard and update it, their sample code of 2 lines of code runs great. See below.
https://developers.google.com/games/services/android/leaderboards
You have to pass in your leaderboard ID given to you when you link up your app to the google play developer console. It's a String that looks something like: "DkbGvageyBASEWEFCx."
Updating and Getting a leaderboard will crash if you aren't connected. Check out this complete sample code below.
//to update
if (getApiClient().isConnected()) //getAPIClient is part of BaseGameUtils
Games.Leaderboards.submitScore(getApiClient(), leaderboardID, score);
//to show
if (getApiClient().isConnected())
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(getApiClient(), leaderboardID), 1337);
Lastly, if you are using an app with a different keystore that has a different SHA1 (Secure Hash Algorithm) than the one that you have on the google play store, then there will be an error and you will not be able to connect. So if you uploaded an app with a keystore with an SHA1 like ab:cd:de... and you're debugging your app, you may see problems since Eclipse will use a default android debug keystore which has a different SHA1.
You will not be able to connect and consequently, you will not be able to use any google play services.
I recommend you look at the sample code called "Trivial Quest."
https://github.com/playgameservices/android-samples
It's under eclipse_compat. This sample code shows one how to sign in and unlock an achievement. If you can sign in, you can do achievements and leaderboards really easily.
There's a lot of stuff but you have given us only a small piece of the puzzle. If you have any more problems, please let us know.
I think, maybe, you need put Google Play Services Library in your dependencies,
In this line :
03-10 17:44:54.071: E/AndroidRuntime(31435): at com.google.android.gms.internal.dw$h.b(Unknown Source)
Probally you have problems with maps dependency of google, the library GMS from google is used
to maps and other services from Google Play Services, if you have problems with that, is possible you have added Wrong versions in your project.
The best way for you is, downalod Google Play Services For Games and put in your project
dependencies.
https://developers.google.com/games/services/downloads/
(this google play services is specific to games )

AdMob add not display Ad in Android App with AndEngine

I have followed all the steps for adding an AdMob Ad into my app from the link at
http://www.wikihow.com/Add-Advertisements-to-Your-Android-Applications-Using-Admob
But when I run my App it does not display the Ad. My app uses AndEngine and hence the target =android-17 as opposed to android-13 specified in the link which causes compilation errors. I added the method onCreateBundle() and wanted to test AdMob. But I get this error in logCat
in my activity_main.xml for with the message
"Error inflating class com.google.ads.Adview. I can see that the jar file has been added to the build path.
Can you please let me know what I am doing wrong. I added the code more than 12 hours back and yet there is no display.
The problems was fixed by by clicking Project->Propoerties->Build Path-> Order & Export and then building. See
Error inflating class com.google.ads.AdView

Categories

Resources