I know this question has been asked many times, but I didn't find exact solutions which I would understand.
I have made a little game with android studio and I would like to publish it. But then I find out that I can't use package name "com.example". How do I change this to "com.MYNAME"?
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.MYNAME.APPNAME" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="#string/achievements"
android:name=".Achievements"
android:parentActivityName=".MainActivity" />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.MYNAME.APPNAME.MainActivity" />
</application>
</manifest>
If I change package="com.example.MYNAME.APPNAME"topackage="com.MYNAME.APPNAME", there will be errors in android:name=".MainActivity", android:name=".Achievements", android:parentActivityName=".MainActivity" and android:value="com.MYNAME.APPNAME.MainActivity".
Thank you for help!
You need to change .java file package name also.
Then clean the project and build again.
Because .MainActivity is still in package name "com.example.MYNAME.APPNAME"
please do the following to change your package name to the new one
Right click on your project
Choose Android Tools
Choose Rename Application Package
Enter your new package name then click ok
Please check this out and change com to org and then you can publish your app
https://youtu.be/A-rITYZQj0A
You don't have to do anything manually, Just right click on the package name > refactor > rename. Everywhere in your project the project name will be changed :)
Related
i had a problem, the Android Studio give me a warning which say:
"The acitivity is not declared in Android Manifest" this appear when i look on the Edit Configuration.
I see in another topic wich says that i have to put in androidManifest.xml
But i already did, and the Android Studio doesnt take it.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.drdower.myapplication" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".AplicacionSencillaInicio"
android:label="#string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AplicacionSencillaResultado"
android:label="#string/app_name"/>
</application>
</manifest>
Which problem could be?
Thank u!
copy the code
delete the activity class
recreate one with same name
paste the code
Place your whole package path
com.example.drdower.myapplication.AplicacionSencillaInicio
Then clean your Project.
Also make sure you passed the correct java file name.
I am working with Android Studio 1.0 when suddenly, out of the blue I can not run my app on my phone because it is telling me that it can not find the default activity.
Changing the "default activity" to the specific activity I want to launch, ends in the error that apparently the activity I selected is not declared in AndroidManifest.xml.
Which also isn't true, because I did declare it in the .xml, I didn't remove it or add something new, it always has been there and now it doesn't want to work.
Thank you for reading and maybe answering / commenting. :D
Edit: This is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pack.aproject" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondPageActivity">
</activity>
</application>
</manifest>
you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
I am currently busy in designing a custom view for my major project. I ran through custom view tutorial provided at developer.android.com . I downloaded the associated sharable project because it gets easy to handle and understand the mechanism of the application when source code is in front of you. To my surprise, the project only contains two folders, src and res and there was no android-manifest file. I tried normal import method, import from existing code and createing new project from exsting android code, no luck with any of the methods. Here the link for the project.
Can somebody please explain to me how I can get it working ?
Can somebody please explain to me how I can get it working ?
Create an empty Android project. Copy in the res/ and src/ from the ZIP file. Modify the manifest to point to the activity class that you copied from the ZIP file.
Create a new empty android project. Copy all resources and source files to your project folder.
http://developer.android.com/guide/topics/manifest/manifest-intro.html.
Goto AndroidManifest.xml define activities and permissions accordingly.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="package name"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="packagename.MainActivity"//your mainactivity
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="packagename.SecondActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="packagename.SecondActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
I created multiple packages to better structure our Android-based project. After creating these packages, the application no longer runs. It's a widget application. I noticed that the application manifest needed to be modified and did so. This didn't seem to fix the problem. I don't get any error messages, I'm simply not able to open the main activity page from the application widget. Could anyone tell me how to resolve this issue?
For more detail, I initially had a flat project structure (com.domain.A). Now I have the following:
com.domain.Activities
Activity1.java
Activity2.java
com.domain.Features
Feature1.java
Feature2.java
com.domain.Services
Service_1.java
Service_2.java
etc...
Here's an excerpt from the manifest file:
<activity android:name="com.domain.Activities.Activity1"
android:theme="#style/Theme.D1"
android:label="#string/act1"
/>
<activity android:name="com.domain.Activities.Activity2"
android:theme="#style/Theme.D1"
android:label="#string/act2"
/>
<activity android:name="com.domain.Features.Feature1"
android:theme="#style/Theme.D1"
android:label="#string/fea1"
/>
<activity android:name="com.domain.Features.Feature2"
android:theme="#style/Theme.D1"
android:label="#string/fea2"
/>
<service android:name="com.cmu.Services.Service_1"/>
<service android:name="com.cmu.Services.Service_2"/>
Thanks.
After moving the classes in packages, how have you defined the activities in the manifest.
(as a thumb rule ctrl+click on activity declaration in manifest should take you to class file, else link is broken), its generally better to keep all classes extending Activity in main android package of your app
EDIT:
if your MyActivity lies under package a.b;
then .a.b.MyActivity is to be used for android:name in manifest the dot(.) initially specifies to use package-prefix from manifest package name..
You specify a package in your manifest, then you can just use the . prefix to reference the package for the Activities you define in you manifest. So for example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain"
android:versionCode="1"
android:versionName="1.0" >
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".activities.MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.Activity1" />
<activity android:name=".activities.Activity2" />
You main launcher activity is thus: com.domain.activities.MainActivity and the other two are: com.domain.activities.Activity1 and com.domain.activities.Activity2
I have an android app. (built for 1.5) while installing it on my device it creates no error, but while running it, it says "the application is not installed in your phone"..
can any one help me...?
I have tried this installing after uninstalling it for many times...
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.testapp"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:label="#string/app_name" android:name="WelcomeScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Untitled1"></activity>
<activity android:name="Welcome"></activity>
</application>
</manifest>
Have you got your package name correct? It will be looking for a different application if your package name in the Manifest does not match that of your project
Its an application error. In application there is an manifest file in which we pass two actions ACTION_LAUNCHER and ACTION_MAIN which is not write there thats why this application says "the application is not installed in your phone" please verify from the android developer of this application. IF you have manifest file of this please write down here. i will correct this.
If this answer is useful to you then please tick that this answer is useful to you.
Who or what tells you "is not installed"?
If you have a shortcut on the home screen, this may become stale and you can get this message.
Try going to the list of apps and starting it from there.
I also see potential that the "com.android.*" package you show is causing issues, as this package may be reserved (at least it is not good practice to use it).
Issue solved,
I just copied and deleted the below lines from the manifest file and pasted it again in the same place ...
I dont know how it solved the issue but it just solved it....
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:label="#string/app_name" android:name="WelcomeScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>