Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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}

like image 348
Hossein POURAKBAR Avatar asked Oct 24 '12 09:10

Hossein POURAKBAR


People also ask

What is JAR file in Java with example?

JAR stands for Java ARchive. It's a file format based on the popular ZIP file format and is used for aggregating many files into one. Although JAR can be used as a general archiving tool, the primary motivation for its development was so that Java applets and their requisite components (.

Where are JAR files stored?

The JAR file is stored in the data development project in the JAR folder.

Where to find JAR file in Android Studio?

If you are unable to find the libs folder in Android studio then open your android project in “Project” mode If the project is already opened in the “Android” mode. Then go to Your Project Name > app > libs and right-click on it and paste the downloaded JAR files.


1 Answers

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>
like image 190
Stephane Avatar answered Oct 20 '22 20:10

Stephane