0

I try to use Highcharts in my android java application. i find two official tutorial for use that, but both of them not works and got those error:

first tutorial.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: ir.azonik.testtest, PID: 5160
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{aa.bb.cc/aa.bb.cc.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3365)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
                      ... 

Second

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: ir.azonik.testazs, PID: 18746
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{aa.bb.cc/aa.bb.cc.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "aa.bb.cc.MainActivity" on path: DexPathList[[zip file "/data/app/aa.bb.cc-2mYWDS_pyscw6wLB3r-FKg==/base.apk"],nativeLibraryDirectories=[/data/app/aa.bb.cc-2mYWDS_pyscw6wLB3r-FKg==/lib/arm, /system/lib, /system/vendor/lib]]
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2841)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
       
                ...
A.Motahari
  • 173
  • 5
  • 10
  • It seems that your issue is not related with using the HC, but more with the instant run in the Android Studio, please check this: https://stackoverflow.com/questions/22399572/java-lang-classnotfoundexception-didnt-find-class-on-path-dexpathlist and also I have a question: have you reported it here also? https://github.com/highcharts/highcharts-android/issues/156 – Sebastian Wędzel Aug 18 '20 at 12:50
  • @SebastianWędzel yes, that's me :) and i try to disable instance run, but i can't find that in android studio 4 – A.Motahari Aug 19 '20 at 06:10
  • Ok, so this thread will be continued under the above github link. – Sebastian Wędzel Aug 19 '20 at 07:25

1 Answers1

1

I recently ran into this problem, and found that the it could only run on devices at API level 27 (Android 8.1) and higher. You can have a successful Gradle build at lower levels, but that does not mean that the app will start. Also, make sure that your app was able to run successfully before you imported the Highcharts aar file and updated your Gradle files. That way, you can pinpoint if Highcharts is what is causing the errors.

Here is a screenshot of the devices I tested my app on: Here is a screenshot of the devices I tested my app on

The devices running on API 26 (Android 8.0) were unable to start, but the rest were able to run successfully. Also, make sure to set the "minSdkVersion" to 27 in your app's build.gradle file.

MatejMecka
  • 1,448
  • 2
  • 24
  • 37
  • Thanks, that's works. a funny things, when add this lib with `implementation 'com.highsoft.highcharts:highcharts:8.1.2'` not works! – A.Motahari Aug 23 '20 at 06:06