修改了很多错误 最后还是提示我 keep stopping
报错信息是 at com.example.supermapimobile3d.MainActivity.onCreate(MainActivity.java:23)
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.supermapimobile3d, PID: 14853 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.supermapimobile3d/com.example.supermapimobile3d.MainActivity}: java.lang.IllegalArgumentException: /storage/emulated/0/SuperMap/license/ is not a correct directory at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: java.lang.IllegalArgumentException: /storage/emulated/0/SuperMap/license/ is not a correct directory at com.supermap.data.Environment.setLicensePath(Environment.java:518) at com.example.supermapimobile3d.MainActivity.onCreate(MainActivity.java:23) at android.app.Activity.performCreate(Activity.java:7802) at android.app.Activity.performCreate(Activity.java:7791) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at com.example.supermapimobile3d.MainActivity.onCreate(MainActivity.java:23)别的都是灰色的 只有这一行是蓝色字体了 log里面贴出来的错误
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String sdcard= android.os.Environment.getExternalStorageDirectory().getAbsolutePath().toString(); Environment.setLicensePath(sdcard+"/SuperMap/license/"); Environment.initialization(this); setContentView(R.layout.activity_main); Button btnOpen = (Button)findViewById(R.id.btn_open); btnOpen.setOnClickListener(new OnClickListener()
您好,我按照您说的改完了以后 又出现了新的问题
现在为Caused by: java.lang.NullPointerException: Attempt to get length of null array at com.supermap.data.Environment.checkAndLoadLibrary64(Environment.java:1736) at com.supermap.data.Environment.initialization(Environment.java:584) at com.example.supermapimobile3d.MainActivity.onCreate(MainActivity.java:24)
at com.example.supermapimobile3d.MainActivity.onCreate(MainActivity.java:24)这一行报错
Environment.initialization(this);这一行代码的问题
我写了
ndk { abiFilters 'armeabi-v7a','x86','x86-64' }以后
又报错了
Installation did not succeed. The application could not be installed: INSTALL_FAILED_NO_MATCHING_ABIS
List of apks: [0] 'D:\SuperMapiMobile3D\app\build\outputs\apk\debug\app-debug.apk' Installation failed due to: 'INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113' 这是错误原因
android { compileSdk 31 defaultConfig { applicationId "com.example.supermapimobile3d" minSdk 21 targetSdk 21 versionCode 1 versionName "1.0" multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { abiFilters 'armeabi-v7a','x86' } splits { abi { enable true reset() include 'x86', 'armeabi-v7a', 'x86-64' universalApk true } } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } sourceSets { main{ jniLibs.srcDirs=['libs'] } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation files('libs\\com.supermap.data_v1020.jar') implementation files('libs\\com.supermap.realspace_v1020.jar') testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' }
写了ndk后还是有错误 然后百度写了
splits { abi { enable true reset() include 'x86', 'armeabi-v7a', 'x86-64' universalApk true }
然后又报错
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.supermapimobile3d, PID: 17139 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.supermapimobile3d/com.example.supermapimobile3d.MainActivity}: java.lang.NullPointerException: Attempt to get length of null array Caused by: java.lang.NullPointerException: Attempt to get length of null array at com.supermap.data.Environment.checkAndLoadLibrary64(Environment.java:1736) at com.supermap.data.Environment.initialization(Environment.java:584) at com.example.supermapimobile3d.MainActivity.onCreate(MainActivity.java:24)
at com.example.supermapimobile3d.MainActivity.onCreate(MainActivity.java:24)还是这行报错