Android Studio通過Android Device Monitor查看SharedPreferences文件以及遇到的問題

首先你要了解到:

Android Device Monitor 已在 Android Studio 3.1 中棄用,並已從 Android Studio 3.2 中移除

官方文檔,以及替用組件:https://developer.android.google.cn/studio/profile/monitor.html

 但是可以從你的SDK的安裝路徑下啓動Android Device Monitor

雙擊路徑下...\SDK\tools\monitor.bat啓動Android Device Monitor

一切正常則啓動成功:File Explorer標籤下/date/date/項目路徑/shared_prefs就能看到生成的*.xml文件了

也許你也可能像我一樣啓動Android Device Monitor提示錯誤,提示查看...SDK\tools\lib\monitor-x86_64\configuration\*.log日誌文件;

!SESSION 2020-03-21 17:29:02.552 -----------------------------------------------
eclipse.buildId=unknown
java.version=10.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -data @noDefault
.
.
.
org.osgi.framework.BundleException: The bundle "org.eclipse.core.runtime_3.8.0.v20120912-155025 [46]" could not be resolved. Reason: Missing Constraint: Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3
.
.
.
!ENTRY org.eclipse.osgi 4 0 2020-03-21 17:29:07.459
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).

首先上網查了資料,試了別人的方法,但還是沒有解決;看到有人說monitor還不支持JDK1.8以上版本;發現自己jdk版本10.0.2;修改爲jdk1.8後成功啓動

分享自己查找資料別人的解決方法,錯誤不同,解決方法不同

1.jdk版本過高

2.以管理員身份運行Android Studio

3.配置環境變量JAVA_HOME:你的jdk安裝地址

4.如果.android文件夾是"只讀"的,在文件夾上右鍵-屬性-取消掉"只讀"(我試着取消了,可是再去看屬性又標記了只讀,不知道是不是錯誤不一樣的原因)

1和3的錯誤問題應該是一樣的,Android Studio配置的jdk路徑版本過高或路徑不對。(如果有其他的開發軟件用到其他jdk版本,只需重新配一下Android Studio中的路徑就可以了,不需要改變JAVA_HOME)

配置Android Studio的SDK和JDK默認路徑

Other Settings - > Default Project Structure...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章