ClassNotFoundException after some changes done in manifest file - android

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>

Related

How to change to package name without changing the package name of Activities in manifest?

Let's take an example. I have my activity originally declared in manifest as following.
<activity android:name=".MainActivity"/>
Then I rename the package. Android Studio just automatically adds the new package name into the activity declaration. Let say the new package name is "com.newname", it will become like the following.
<activity android:name="com.newname.MainActivity"/>
My question: How can I fully rename the package without automatically adding the new package name into the activity declaration like that?

Not able to create new Activity in android studio(NullPointerException)

When I try to create a new activity it says NullPointerException
It says IDE fatal when I tried look into the error from the event log
Oops!! I was doing it wrong
There is no Issue if I create the new Activity this way.
You may not have created entry for intent-filter in manifest.If you are creating both java and layout file separately without directly creating a activity.
Create a java file say Main.java
use following code :
public class Main extends AppCompatActivity{
#Override
protected void onCreate(Bundle savedState)
{
super.onCreate(savedState);
setContentView(R.layout.your_layout);
}
and in manifest add after application tag
<activity
android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Follow the below steps:
Open the folder bin under the directory where you installed your Android Studio.
Open the file "idea.properties" and open it with Notepad++/UltraEdit/other_edit_tools.
Add "disable.android.first.run=true" as the final line and save the file.
Because you have another layout/activity/menu/or other things.
I faced the same issue, it inserts the activity into Manifest but never creates a new file.
Try these things
Try to use another name activity/fragment/...
Delete other unnecessary things/files e.g. from drawable, files created previously in other directories as well.
Try this following things...
Try to Build Your Project.
Try to Clean your Project.
If not work then Restart Project/Android Studio.
If still not work Then try to Add Activity with Right click and Add
New Java Class.
And check SDK is proper
and let me know what happens.
Hope this will helps...(:

Intent chooser dialog shows package name besides the Activity label

If I send files via Intent to other applications, the chooser dialog on Samsung devices shows the package name of my application besides the defined Activity labels. On Nexus devices I only see the labels, as expected. How to fix this issue?
On Galaxy Note 3 both, label and package name are shown (see screenshot)
On Galaxy S3 only the package name is visible
Ok, I got it. It happens only if you use equal labels for your Activities. Some devices show you the package name for better differentiation.
Try setting the application label in AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="#string/my_app_name">
<activity>
...
</activity>
</application>
</manifest>

admob cannot be viewed in 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" />

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