Initial activity, which is in the external jar file

Suppose we have activity and resources in jar lib, then we are going to run it from the main apk application, and this did not work for me.

Result: android.content.ActivityNotFoundException: cannot find an explicit activity class {com.mycompany.myapp / EXTERNAL_ACTIVITIES.OtherActivity}

+6
source share
2 answers

First you have to put the jar in / libs Then check if your application controls libs: right click β†’ Android Tools β†’ Add Library Support

Then simply add the classic activity to your manifest link to your 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> 
+1
source
Finally, I found my answer in a similar way. I used to want to put the Jar library (containing activity) in another android project, but I found that I can include all the library code in a new project as follows: 1- Right-click the apk project and go to "Properties". 2- Select "Android" from the left table. 3- Click the "Add ..." button on the bottom panel below "Is a library." 4- In the list that opens, click on the corresponding library project.

The result will be funny. You will have two packages in the "gen" folder and two "R.java" folders, and also your id will be included in the second project. You can access library project variables.

When you run the build command, it will simply include the packages and classes used.

-1
source

All Articles