简体   繁体   中英

Why I can't build app with for a lower Android version?

I use Android Studio, with SDK version 23 in the beginning to code and build app and everything is running ok. But the app only work on cellphone will android 5.0 and above. I want to make a new version for Andriod 4.4. So I download SDK 19 in Android Studio, And then click app -> open modules settings -> flavours -> miniSdkversion to be 19. Can compile, but don't work when run and get the follow errors. Then I also set targetSDK Version to be 19. the same, Get the following error:


29 20:17:44.698 3699-3699/com.hanjing.flocking E/AndroidRuntime: FATAL EXCEPTION: main java.lang.ExceptionInInitializerError at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1319) at android.app.Instrumentation.newActivity(Instrumentation.java:1068) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) at android.app.ActivityThread.access$700(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4921) 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:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1307]: 1874 cannot locate 'rand'...

                                                                    at java.lang.Runtime.loadLibrary(Runtime.java:370)
                                                                    at java.lang.System.loadLibrary(System.java:535)
                                                                    at com.example.mac.flocking.MainActivity.<clinit>(MainActivity.java:37)
                                                                    at java.lang.Class.newInstanceImpl(Native Method) 
                                                                    at java.lang.Class.newInstance(Class.java:1319) 
                                                                    at android.app.Instrumentation.newActivity(Instrumentation.java:1068) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 
                                                                    at android.app.ActivityThread.access$700(ActivityThread.java:140) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                    at android.os.Looper.loop(Looper.java:137) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:4921) 
                                                                    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:1038) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) 
                                                                    at dalvik.system.NativeStart.main(Native Method) 

If I also set compile version and the buildtool version to be 19, errors show when compile.

So I don't really know what I should do. I just want to make a new version which can run on a lower Android cellphone.

Pls help! Thank you very much!

Jing

This is the build.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Check for the error:

Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1307]: 1874 cannot locate 'rand'...

Do you use any code which is not available in a lower android version?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM