Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by evelan · Dec 30, 2015 at 04:52 AM · androidandroid buildandroidpluginandroid-manifest

java.lang.ClassNotFoundException while running Android activity

After long fight with building project i stuck on launching android activity

logcat output:

 I/Unity   (20479): Welcome on Android border
 I/Unity   (20479): AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/testapp/androidplugin/app/SplashScreen;
 I/Unity   (20479): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/testapp/androidplugin/app/SplashScreen;
 I/Unity   (20479):      at com.testapp.androidplugin.app.UnityBinder.foo(UnityBinder.java:16)
 I/Unity   (20479):      at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
 I/Unity   (20479):      at com.unity3d.player.UnityPlayer.a(Unknown Source)
 I/Unity   (20479):      at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
 I/Unity   (20479): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.testapp.androidplugin.app.SplashScreen" on path: DexPathList[[zip file "/mnt/asec/com.testapp.androidplugin.app-2/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.testapp.androidplugin.app-2/lib/arm, /system/lib, /vendor/lib, sy
 stem/vendor/lib, system/vendor/lib/egl, system/lib/hw]]
 I/Unity   (20479):      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
 I/Unity   (20479):      at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
 I/Unity   (20479):      at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

First line is from Java class, so something happen...

UnityBinder.class

 public static void foo(Activity activity) {
     Log.i("Unity", "Welcome on Android border");
     Intent myIntent = new Intent(activity, SplashScreen.class);
     activity.startActivity(myIntent);
 }

both classes are in the same package, I event tried with providing full path to package, but same result

     if (GUI.Button(new Rect(200, 200, 400, 400), "Start"))
     {
         var androidJC = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
     var jo = androidJC.GetStatic<AndroidJavaObject>("currentActivity");
     var jc = new AndroidJavaClass("com.testapp.androidplugin.app.UnityBinder");
     jc.CallStatic("foo", jo);
     }

SplashScreen is extended by AppCompatActivity

I used Java decompiler to look at files structure, and SplashScreen class exists there In Plugins -> Android directory I have appcompat-v7-23.1.1.aar, design-23.1.1.aar, classes (which is from my unpacked *.aar android module), rest and assets folder.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image nasha · Apr 28, 2016 at 08:12 AM 0
Share

Hey,

Did you find any solution to this?

avatar image virajnagar · Oct 25, 2016 at 05:04 PM 0
Share

Any resolution to this ??

avatar image iamsidv · Jun 25, 2017 at 05:20 PM 0
Share

Hi @evelan did you manage to solve this issue yet?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by nasha · Oct 25, 2016 at 06:34 PM

I think it requires some library on the Java library side, which also needs to be put explicitly in the unity Android plugin folder, alongside the [library] .jar ( or aar) file. It worked for me.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image virajnagar · Oct 25, 2016 at 07:33 PM 0
Share

Could you kindly mention which library that would be. Appreciate your response. Thank you.

avatar image iamsidv virajnagar · Jun 25, 2017 at 05:20 PM 0
Share

@virajnagar Any solution on this yet?

avatar image iamsidv · Jun 25, 2017 at 05:22 PM 0
Share

Hi, Please list the libraries that you pasted inside the android plugin folder. I would really appreciate if you can help me in this issue.

avatar image
0

Answer by mm49307 · Oct 28, 2017 at 04:03 PM

You should extend android.app.Activity, rather than AppCompatActivity. bacause gradle does NOT produce a fat-jar, so that AppCompatActivity would be available in your aar/jar file. (It is only available in your gradle dependency, thus you can build your plugin inside Android Studio.)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android build crashes on start up. 2 Answers

CommandInvokationFailure: Gradle build failed. unity 2019.4.22 1 Answer

Is it possible to register android application in AndroidManifest.xml? 0 Answers

Using CustomUnityPlayerActivity, which inherits from UnityPlayerActivity, will cause problems. 0 Answers

Why cant I change the android:windowBackground? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges