Importing android projects that do not have android manifest file - android

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>

Related

The acitivity is not declared in Android Manifest

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.

R not generated, XML file contains error but which XML file?

My R file is not generated after I clean my project. And according to my research on stack overflow, I think I have an error in my xml file but I dont know which xml contains the bug. I went through all of them including the AndroidManifest file.
Is there any way or tool to help me find out which xml contains the error? I have been stuck with this problem for like 10 hours. Please Help!
p.s
I have 2 different custom view where both have the same namespace (but uses in separate xml file), is that a problem?
AndroidManifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.packagename.appname"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen" >
<activity
android:name="com.packagename.appname.activity.SplashScreenActivity"
android:icon="#drawable/ic_app"
android:label="#string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger" />
</activity>
<activity
android:name="com.packagename.appname.activity.MainActivity"
android:enabled="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.packagename.appname.activity.SelectActionActivity"
android:enabled="true"
android:label="#string/app_name" >
</activity>
</application>
</manifest>
Problems View
Found the bug... I declared the same id twice in the ids.xml. I would like to share how I found which xml contains the error. So I copied out individual xml content and deleting them from the project to see if the R file would generated. For all the non-xml, I set them to not including into build path for the time being. Its not the best way to find a error but it is a way. Thanks for everyone who reply to question. Happy coding.

Two AndroidManifest.xml files, which one is relevant

I am learning to develop android apps from android site. As you can see here they talk about AndroidManifest.xml . My project seems to have two such files , with diffferent content.
One located at : workspace\MyFirstApp
Having contents
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.myfirstapp.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>
</application>
ANother located at workspace\MyFirstApp\bin and having below contents , in addition to what the first file has
<activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity" />
</activity>
I am not sure why there are two AndroidManifest.xml . Also which one is my main one being used by my project?
This workspace\MyFirstApp\bin is automatically build on Build where as
workspace\MyFirstApp this is your projects Manifest which you can modify and alter this is you main Manifest
Note: *Bin* and Gen Contents are automatically generated You shall not bother about them you can check by Cleaning the project both got emptied and on Rebuilding or Running again Gen and Bin Contents are recreated
bin folder is automatically created when you run your application.You don't need to bother about that.The original Android manifest file is the one in your work space.You can make all possible changes there and when you run your application it will automatically reflect in your bin folder.

Cannot upload an .apk file to the market

I have developed a new application for Android and my application is completed. It doesn't have any errors except for a few (2) harmless warnings. I created an .apk package using the tools available in ECLIPSE. It created a key and an .apk file. Created all right. BUT when I upload the .apk file I get an error telling that I cannot use the following in front of the package name :[com.android,com.goolge,android,com.example]
Below is my manifest details
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.Scheduler"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/icon"
android:label=".SchedulerActivity" >
<activity
android:label="#string/app_name"
android:name=".SchedulerActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".addSubject"/>
<activity android:name=".Assignment"/>
<activity android:name=".CameraTake" android:screenOrientation="landscape"/>
<activity android:name=".view_details"/>
<activity android:name=".about"/>
<activity android:name=".help"/>
<activity android:name=".MyAlarmService"/>
<activity android:name=".Assignment_view"/>
<receiver android:name=".MyAlarmService" />
</application>
I tried some methods that are explained in here but it didn't work. Can anyone help me?
It is because of
package="android.Scheduler"
that you are getting this problem.
Notice in your file browser that you probably have src > android > scheduler
you cannot have android there.
all I can think of for a quick fix, is start a new project FROM that one, and in the setup set the package name to com.something.yourappname, but where "something" is do not include "google" or "android"
You have choosen incorrect package name "android.Scheduler", just change your package name.
For eg. if your name is "ravi" then choose package name something like this-
"com.ravi.scheduler".
Steps change package name (eclipse):-
Under your project folder just go to "src" then here you found "android.Scheduler" right click on it, choose "Refactor" -> "rename" & then write your desired package name like "com.ravi.scheduler" & click OK.
Now Rebuild/Run your project & then do application signing.
Now you are ready to upload your app to Google Play.

Contact permissions problem in android manifest

I need to set the permission in the manifest to read, I manually edited the manifest after having problems trying to use the android manifest editor. My code is below and is currently proving to be erroneous. Any help appreciated. :)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ac.uk.d"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".Quiz"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
</manifest>
The issue is that you have not cleaned the project. To clean the project, select 'Project' on the top menu bar then you'll find clean upon which you clean the selected project or clean all projects as per your needs..

Categories

Resources