- Home /
Android - Non main activity plugin not working: Class Not Found Exception
Hi everyone
I'm struggling to make my plugin work for Android devices. I'm trying to make an Android plugin that recognizes iBeacons. I use a open source library for that. But when the app is build and run, it won't recognize it. Keep in mind this is NOT the main activity, because I already use a plugin that is set as main in the manifest.
[Attached images & files can be found in this post: http://forum.unity3d.com/threads/android-non-main-activity-plugin-not-working-class-not-found-exception.287818/]
So, how did i make my plugin? I used eclipse and set the project as library so it would make a .jar file when it builds. In the 1st attached image you can see the project setup. Don't mind the closed projects. In the 2th one, you can see I ticked 'Is Library'.
Afterwards, I placed the plugins (my .jar file and the one from proximitykit) in: Assets/Plugins/Android. This can be viewed in the 3th image I attached. In code I tried to start the activity. (.cs file in the .rar attachment)
Last, I added the activity to the AndroidManifest as following:
<activity android:name="com.kristofvdh.ibeacon.BeaconScanActivity" />
When I build and run the application, the app won't recognize my class created in the plugin. (image 4)
I have read that you could create a build with ant, but ant cannot find my proximitykit packages. (this image is inside the rar, because I can only attach 5 files) So if someone could please help me make this work, because I am a bit stuck. I tried allot of things, searched all over the internet, but cannot make my app work with multiple plugins (activities).
Thanks in advance!
Answer by Augality · Jan 14, 2015 at 02:52 PM
Hi everyone
I found the solution to this problem myself. I had to fix my ant build script in order to create the correct .jar file.
Now my app finds the class, but there still is another problem: Exception: JNI: init'd AndroidJavaObject with null ptr!
If you have an idea, you can always post it here: http://forum.unity3d.com/threads/android-non-main-activity-plugin-not-working-class-not-found-exception.287818/#post-1914018
Also, the ant script I created can be found on that page as well. I hope this solution could help others.
More info about ant scripts can be found here: http://ant.apache.org/