admob cannot be viewed in android - android

i tried using Admob in my app by running it in a device and it showed nothing and i found the followig errors in logcat
04-07 10:49:05.570: ERROR/Ads(1084): AdView missing required XML attribute adUnitId.
04-07 10:49:07.850: ERROR/Ads(1084): Could not find com.google.ads.AdActivity, please make sure it is registered in AndroidManifest.xml.
But in manifest file i have mentioned the following lines
{<meta-data android:value="axxxxxxxxxxxxxxxx" android:name="ADMOB_PUBLISHER_ID"/>
<activity android:name="com.google.ads.AdMobActivity"/>}
What is my error...
I have totally 4 Activities in my App and i am trying to add the admob in my 4th activity.
whether i have to add the above said lines with that activity or anything else pls help me friends...

The error shown can be fixed by adding the following to the manifest file:
<activity android:name="com.google.ads.AdActivity"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|keyboard|keyboardHidden" />

Related

is android:exported="true" required for internal use of content provider

I have defined a provider in my application manifest :
<provider
android:authorities="com.example.myapp.provider"
android:name="com.example.myapp.MyProvider">
</provider>
The provider is required only to be used within the application. But I get the below error when i try to run my activity :
Failed to find provider info..
But it works perfectly if i simply set the export attribute of the provider in the manifest :
android:exported="true"
So my question is why is this required? Because, according to the documentation(http://developer.android.com/guide/topics/manifest/provider-element.html#exported), export is required only if the provider is to be available for other applications. Am i doing something wrong?
[Edit] : Suprisingly, the error has disappeared now even after removing the exported attribute, without making any other changes. I have no clue why it is working now. Probably some stupid mistake from my side. I leave this question open in hope of getting any clues as to what must have gone wrong.
[Edit] : I am facing this issue again with a receiver this time. So it was not a mistake from my side, as i assumed in my previous edit. I suspect something is wrong in the ADT build tool.
Make sure your <provider> tag is inside the <application>...</application> tags.
<application>
...
<provider
android:authorities="com.ingamedeo.databasetest.contentprovider"
android:name=".db.ContentProviderDb"
android:exported="false">
</provider>
</application>
Update: You can no longer set
android:exported="true"
you will encounter java.lang.SecurityException: Provider must not be exported exception.

Orientation Locking to landscape not working on emulator but on device

I have used following code in activity onCreate() to lock view only to landscape mode, it is perfectly working on device but not working on emulator, Since i dont have a device now it's hard to develop
code :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
Please help
Try this:
android:screenOrientation="sensorLandscape"
Put this Code[Attribute] in Activity tag of AndroidManifest.xml file it should work.
In your manifest file simply add
<activity
android:name="yourActivity name"
android:screenOrientation="portrait" >
</activity>
Apologies if this is too obvious.. You have to manually put your emulator in landscape mode, I think. I think it's the F9 key, but it's been a while since I've done that.
Try this way, hope this will help you.
Define this attribute "android:screenOrientation="landscape"" as your activity in AndroidManifest.xml
Try this
Put below line of code in your manifest
<activity>
android:screenOrientation="landscape"
</activity>
It works for me....

ClassNotFoundException after some changes done in manifest file

hey guys
i change the package name in manifest file so that i have a separate package for all the activities and it is giving me error classnotfoundexception when although the classes shown in log cat are present in my source folder.
i even then changed the package name to previous one. and still it is giving me the same error.
In your manifest file, if the package address of the activity contains a relative namespace address (starting with a dot) like this:
<activity
android:name=".addr.MainActivity"
</activity>
you can get it to work by changing it to the full address like this:
<activity
android:name="com.pkg.addr.MainActivity"
</activity>

Android error, failed to set top app changed

Can somebody please throw some light on the arcane error "Failed to
set top app changed", by the activity manager?
I'm wondering what causes this error. In one of my application I'm
making a view fullscreen and then switching back. For the first time
things are ok but then if i try to make the view full screen again, I
get a crash and the error mentioned above is found on logcat.
Any help is greatly appreciated.
Reagrds,
M
I just encountered this problem today myself.. let me tell you what did the trick for me... maybe it will help you too.
anyway in my case it crashed because i overrided onActivityResult and inside that event i tried to do this:
Bundle extra = data.getExtras();
String albumId = extra.getString("id");
this is old code that got left in the application.. after deleting this everything worked as expected.
hope this helps in some way.
I had the same problem with my app, the activity crashed and "activity manager: fail to set top app changed!" in logs. Turned out to be one line of code in the onPause caused the problem. Check your onPause method of the Activity that launches the new Activity to see if something should not be done there. I think there could be many reasons causing this problem, but the basic idea is that the launching activity does something wrong when the new Activity is going to show up.
My problem was that i change orientation on activity start and needed to add android:configChanges="orientation" , like this:
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<activity
android:name=".RiskniMilionActivity"
android:label="#string/app_name"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

How to register a new activity in AndroidManifest.xml?

I always get an error when I run my created application and based on my research I haven't registered my Activity in the manifest. How can I register a new activity in AndroidManifest.xml?
Assuming you're using Eclipse,
Goto your Android Manifest, goto the Applications Tab (at the bottom), click on "Add", Choose Activity. On the right, next to Name: Click on Browse, to get a list of available activities, just add it and you're set! :)
You could right way just edit the Manifest XML aswell. It's upto you.
<activity android:name="com.kl.android.ReadSMS.ViewSMS" />
just use the class name after '.'
like the following
<activity android:name=".ViewSMS"/>
In Android Studio, Go to AndroidManifest.xml file and use
<activity android:name="YourPackageName.ClassName">
For example,
<activity android:name="com.android.favoritetoys.MainActivity">
For More List of activity attributes in AndroidManifest.xml

Categories

Resources