Android Intent through jar

2019-07-23 03:23发布

问题:

I have development one Android Application which has one UI design (like user name,password) i converted my Application into jar(it means i convert my application as library project) after i got the Jar.i used in another application i follow this method

1. I added my jar into Reference library path
2. I include the jar in library path
3. I added my jar in Android manifest file like :
<activity android:name=".MainActivity"></activity>(which in jar file)
4. In my src of my second Application i include my jar ,and also using intent to call my previous application

i call my jar using intent like

 Intent i = new Intent(this, com.example.testapp.MainActivity.class);
      startActivity(i);

but i got the following error

FATAL EXCEPTION: main
 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.tui.com/com.example.testapp.MainActivity}; have you declared this activity in your AndroidManifest.xml?

but i already declare my activity in Android manifest file, i hope i did every thing correct,but i dnt know why i geeting this error

any one know how to access jar using intent in android

回答1:

Actually you added your activity in manifest as .MainActivity

and absolute path become yourpackagename.MainActivity

add like com.tui.com.com.example.testapp.MainActivity



回答2:

It should be

<activity android:name="com.example.testapp.MainActivity"></activity>

Not

<activity android:name=".MainActivity"></activity>