Hi i've added the AndroidAnnotations and configured it; it generates the activity with the underscore _ as suffix, but when I try to lunch the app, it gives this error
05-26 04:17:23.524: E/AndroidRuntime(5096): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{android_app.candgo/android_app.candgo.HelloAndroidActivity_}:
java.lang.ClassNotFoundException: Didn't find class
"android_app.candgo.HelloAndroidActivity_"
on path: /data/app/android_app.candgo-1.apk
Any suggestion about why it doesn't work
PD: I've ADT v22
PD: I've the HelloAndroidActivity_ registered at manifest
This is my manifest.xml (sorry for the delay)
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="MainActivity_">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You need to add the ".apt_generated", or whichever folder AA outputs to, to your source directories listing. In Android Studio, you can find this in Project Settings -> Modules -> module_in_question -> Sources
Check your manifest file for a entry of the activity. Check the name.
If you updated ADT to rev 22. you can try this java.lang.ClassNotFoundException after changing nothing in the project but upgrading eclipse android sdk.
Check the package name in manifest
<manifest package="com.example.mypackaganame" //check the name
Check under application tag for the activity entry
<activity
android:name="com.example.mypackaganame.MainActivity"
// this is the main activity
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Say you have second Activity. This how you declare for implicit intents
<activity
android:name="com.example.mypackaganame.SecondActivity"
// this is the Second activity
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.mypackaganame.SecondActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Foe explicit intents
<activity
android:name=".SecondActivity"
// this is the Second activity
android:label="#string/app_name" >
</activity>
you need to register the activity class(AndroidAnnotations) in your manifest.xml,like:
<activity android:name = "com.your.packageName" android:screenOrientation="portrait" android:configChanges = "orientation"/>
then you can use it.
If you are using Eclipse follow these steps :
Step 1.
Go to Java Compiler and make sure that Compiler compliance level is set to 1.6, otherwise the processor won't be activated
Step 2.
Go to Java Compiler > Annotation Processing and choose Enable annotation processing
step 3.
Go to Java Compiler > Annotation Processing > Factory Path and add the processor JAR : androidannotations-X.X.X.jar.
step 4
Confirm the workspace rebuild
Related
I just updated android studio 1.3 to 1.5(1.5 downloaded from stable channel) and now created new project it is compiling fine but not deploying on the device and emulator.Here is the log cat image
You must declare your activity in the manifest file in order for it to be accessible to the system. To declare your activity, open your manifest file and add an <activity> element as a child of the <application> element.
<manifest ... >
<application ... >
<activity android:name=".ExampleActivity" />
...
</application ... >
...
</manifest >
When you create a new application using the Android SDK tools, the stub activity that's created for you automatically includes an intent filter that declares the activity responds to the "main" action and should be placed in the "launcher" category.
<activity android:name=".ExampleActivity" android:icon="#drawable/app_icon">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
there maybe duplicate of this but I can't find any solution working for me.
I have downloaded latest Eclipse Juno from developer.android.com day before yesterday and it seems to act weirdly. I am trying to run "Hello World" but it is not creating default Activity in Manifest file.
Then I am also getting this error :
Unable to write Jarlist cache file
workspace\appcompat_v7\bin\jarlist.cacheworkspace\appcompat_v7\bin\jarlist.cache
Can someone please suggest
Add this code in your Manifest.
<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>
Hi I have an activity defined in my Library like so...
<activity
android:name="com.company.application.corelibrary.recording.DesiredActivity"
android:label="#string/title_activity_tracking"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I then want to use this library to launch with in another application which I am doing like so...
<activity
android:name="com.company.application.corelibrary.recording.DesiredActivity"
android:label="#string/title_activity_tracking"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However when I am going to build it it comes back with...
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.company.application/.corelibrary.recording.DesiredActivity }
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Error type 3
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Error: Activity class {com.company.application/com.company.application.corelibrary.recording.DesiredActivity} does not exist.
com.company.application is my project package.
com.company.application.corelibrary is my library package.
I have included the library in my project.
What am I doing wrong?
ADDITION
I just renamed my library project's package name to something different than that of my project as I thought maybe as they were similar the project may look in it own source for the class but this did not work either.
in my application, i have wrote activity in manifest like:
<activity android:name="MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
i have also declare another activity (which activity belongs to my library) in the manifest as:
<activity android:name="com.facebook.LoginActivity"
android:label="#string/app_name" />
hope this will help u.
N.B:
u should not use
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
for two activity in a manifest.
I thought I would answer my own question. The other answers may be valid but this is what solved mine.
Before my activity declaration in the new projects manifest I had the following which was causing issues.
<uses-library
android:name="com.corecoders.st.corelibrary"
android:required="true" />
I removed that, cleaned and rebuilt the project and it launched fine.
I have solved this issue by implemeting he solution io.card does in their library. By wrapping with the application tags the activities into your library manifest.
<application>
<activity
android:name="com.eckoh.eckohroute.ActionConsumingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="#style/Theme.Dialog.ActionActivity" />
</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 am running tab based application in android.When i try to install the application on the emulator it gives output in the console as
[2011-03-08 12:40:35 - TabBar] Application already deployed. No need to reinstall.
[2011-03-08 12:40:35 - TabBar] \TabBar\bin\TabBar.apk installed on device
[2011-03-08 12:40:35 - TabBar] Done!
Can anyone tell how should i pursue
Thanks in advance
Tushar
I'm also tackled with this same problem and finally I found the solution for it. When you creating a new android project using Eclipes and if you didn't create a activity for your first window, your project's Manifest also don't create proper codings for you to application launch up.
So, you should hardcode them yourself.
First check these codes are available or not in your Project's Manifest file, within your main activity tags.
**
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
**
These two code lines are very important. Because these two lines are calling to android OS to launch this app.
So, Make sure these codes are available in your project's Manifest file. If it's not this below Manifest file code will gets you rough idea to fix this problem.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mershanfernando.testingappz"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name">
<activity android:name=".Main"
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>
</manifest>