Note that there are some explanatory texts on larger screens.

plurals
  1. POActivity in a library project
    primarykey
    data
    text
    <p>I've an android library project, package name- com.example.lib, with an Activity called SecondActivity. I exported this library project as a Jar file, by including generated Source and Resources. I pasted this Jar file in the Host Application's "libs" folder. I also added this jar file into build path, by right clicking on it and selecting "Add to Build Path" option.</p> <p>When I run this host application, I get NoClassDefFound Exception. Package name, activities names are different. I've also included the library project's Activity's details in the Host application's manifest. But I cant execute this successfully. </p> <p>When I checked the "gen" folder of the Host application, I found out that library's R file is not getting generated. Below I've my manifest details. </p> <p>please help me guys.</p> <p>Mainfest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.secondapp" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.secondapp.SecActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="com.lib.firstapp.MainActivity"&gt;&lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Error Log:</p> <pre><code>FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.lib.firstapp.MainActivity at com.example.secondapp.SecActivity$1.onClick(SecActivity.java:23) at android.view.View.performClick(View.java:3571) at android.view.View$PerformClick.run(View.java:14247) at android.os.Handler.handleCallback(Handler.java:605) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4517) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760) at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>My intention is to Create a JAR file. My clients can use my application by implementing this JAR file into their application. I've tried implementing services and receivers in this JAR file. Only thing that I cant do is Activities. Can I include Activities in a JAR?? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload