Hossein POURAKBAR
Hossein POURAKBAR

Reputation: 1181

Starting activity which is in external jar file

Suppose that we have an activity and it's resources in a jar lib, then we are going to start it from main apk app, and it didn't worked for me.

result: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.mycompany.myapp/EXTERNAL_ACTIVITIES.OtherActivity}

Upvotes: 6

Views: 1411

Answers (2)

Hossein POURAKBAR
Hossein POURAKBAR

Reputation: 1181

Finally I found my answer in a similar way. Previously I wanted to put a Jar library (containing an activity) into other android project, but I found that I can include all the library code in new project in this steps: 1- Right-Click on apk project and go to Properties. 2- Select "Android" from left table. 3- Click on "Add..." button in bottom panel below "Is library" checkbox. 4- From opened list click on proper library project.

The result will fun. You will have two packages in your "gen" folder and two "R.java" and also your id's will include in second project. You can access library project's variables.

When you start build command, it will just include used packages and classes.

Upvotes: -1

Stephane
Stephane

Reputation: 171

First you have to put you jar into /libs Then check if your app manage libs : right click-> android Tools -> Add library support

Then, just add a classical activity in your manifest link to you activity:

<activity android:name="com.xxx.yyyyy.zzzzz"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:noHistory="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Upvotes: 2

Related Questions