Reputation: 75
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
com.domain.Features
com.domain.Services
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.
Upvotes: 0
Views: 2830
Reputation: 10908
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
Upvotes: 0
Reputation: 9362
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..
Upvotes: 1