首页 / 浏览问题 / 移动GIS / 问题详情
依赖错误,链接失败
23EXP 2023年08月01日

sdk:28
gradle plugin:7.1.0
gradle:7.2
使用依赖为‘androidx.appcompat:appcompat:1.4.0' , 'com.google.android.material:material:1.5.0'
此时显示‘androidx.appcompat:appcompat:1.4.0'需要sdk31及以上
修改为‘androidx.appcompat:appcompat:1.3.1'
显示错误:

appcompat和material的版本应该选择什么比较合适呢

1个回答

您好,建议使用

androidx.appcompat:appcompat:1.2.0与
com.google.android.material:material:1.3.0如果还是配置失败,可以参考该工程

https://pan.baidu.com/s/125BqTeH8zNi5D4zfq8iekQ?pwd=127h 

3,685EXP 2023年08月02日

工程下载之后试着跑了一下,只有sdk用的自己的,其他都没变,使用真机运行还是出现了一些问题

FATAL EXCEPTION: main                                                                                                   
Process: com.bestyou.myapplication, PID: 32493                                                                                                   
java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.bestyou.myapplication/com.bestyou.myapplication.MainActivity}: 
java.lang.NullPointerException: Attempt to invoke virtual method 'void 
java.io.FileInputStream.close()' on a null object reference                                                                                                  	
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3771)                                                                                                    	
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3938)                                                                                                    	
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)                                                                                                   	
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:2318)                                                                                                    	
at android.os.Handler.dispatchMessage(Handler.java:106)                                                                                                    	
at android.os.Looper.loopOnce(Looper.java:210)                                                                                                    	
at android.os.Looper.loop(Looper.java:299)                                                                                                    	
at android.app.ActivityThread.main(ActivityThread.java:8306)                                                                                                    	
at java.lang.reflect.Method.invoke(Native Method)                                                                                                    	
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)                                                                                                    	
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)                                                                                                    
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void 
java.io.FileInputStream.close()' on a null object reference                                                                                                    	
at com.supermap.data.Environment.readFile(Environment.java:2302)                                                                                                    	
at com.supermap.data.Environment.checkDevice_New(Environment.java:824)                                                                                                    	
at com.supermap.data.Environment.initialization(Environment.java:626)                                                                                                    	
at com.bestyou.myapplication.MainActivity.onCreate(MainActivity.java:74)                                                                                                    	
at android.app.Activity.performCreate(Activity.java:8194)

at android.app.Activity.performCreate(Activity.java:8160)                                                                                                    	
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)                                                                                                    	
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3744)                                                                                                    	
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3938)                                                                                                     	
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)                                                                                                  
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:2318)                                                                                                     	
at android.os.Handler.dispatchMessage(Handler.java:106)                                                                                                     	
at android.os.Looper.loopOnce(Looper.java:210)                                                                                                     	
at android.os.Looper.loop(Looper.java:299)                                                                                                     	
at android.app.ActivityThread.main(ActivityThread.java:8306)                                                                                                    	
at java.lang.reflect.Method.invoke(Native Method)                                                                                                     	
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)                                                                                                     	
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073) 

依旧存在空指针问题,是否还是因为sdk高于28?
添加权限后license文件夹出现但没有iMobile许可文件,进行了手动添加(11i的),但还是上面那个问题
.smwu文件因该也需要修改,但暂时没有改动

gradle版本不应该超过28,因为gradle28之后的版本应用统一使用沙盒模式,不允许访问用户文件夹
...