Cordova打包apk問題總結
1.紅米手機 需要有SIM卡才能通過adb命令安裝apk
2.EBUSY: resource busy or locked,
unlink 'D:\WorkSpace_apk02\lenovo\lenovo_guide_02\platforms\android\app\build\outputs\apk\debug\output.json'
--解決辦法:打開任務管理器=》詳細信息=》結束進程OpenJDK Platform binary
3.WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 5.0 of the Android Gradle plugin.
--解決辦法:配置5.0以下的gradle環境
4.打包報錯:This project uses AndroidX dependencies,
but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
--解決辦法:AS工具打開cordova項目中的android 項目,使所有useAndroidX=true
5.apk 簽名打包報錯: Connect to 192.13.4.195:1080 [/192.13.4.195] failed: Connection timed out: connect
--解決辦法:修改build.gradle文件,文件目錄platforms/android/app/build.gradle,
6.android 9 以上系統不支持訪問HTTP非安全協議,
解決辦法:
(1)創建xml文件
在res文件下創建xml目錄,然后創建network_security_config.xml 文件(文件名稱可以自己定義)
在network_security_config.xml 文件中輸入以下內容
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
(2)在AndroidManifest中配置此文件
在 AndroidManifest.xml 的application 標簽加上network_security_config
android:networkSecurityConfig="@xml/network_security_config"
7.Could not receive a message from the daemon
解決辦法:關閉電腦的移動熱點,問題即解決。
8.java.io.IOException: Couldn't delete D:\WorkSpace_apk03\test_ICBC\demo05\platforms\android\app\build\outputs\apk\debug\output.json
解決方案:
關閉其他打開此android app的軟件,如android studio
- 使用webview插件跳轉外部url訪問H5的時候,H5新增了調用原生api的js方法,而啟動進入app后卻沒有效果。
解決方案:
①安裝清除緩存插件 cordova-plugin-cache-clear,cordova命令安裝超時的話可以在github上下載到本地,再安裝;
②H5 Vue代碼index.html頁面添加插件清除緩存方法:window.CacheClear()
10.Couldn't delete stale output file
解決方案:關閉其他打開了此項目的編輯器等,如android studio
11.gradle project sync failed.Basic functionality
解決方案:
原文鏈接:https://jingyan.baidu.com/article/597a06430710ca312b52430b.html
①在gradle-wrapper.properties文件里會看到“distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip”,其一:“gradle-6.1.1-all.zip”是我們待會要手動下載的gradle版本,其二:“https\://services.gradle.org/distributions/”是我們要下載的鏈接地址。把鏈接地址中的“https\:”的“\”去掉,得到一個正常一個正常地址“https://services.gradle.org/distributions/”,如下圖:
②接下來下載gradle:打開瀏覽器,把剛剛得到的正常地址“https://services.gradle.org/distributions/”,復制粘貼到瀏覽器地址欄里,回車即可進入gradle官網,然后選擇對應的步驟二看到的gradle版本——gradle-6.1.1-all.zip,下載即可。
③接下來,吧下載下來的gradle-6.1.1-all.zip放在相應文件夾下解壓,然后點擊File>搜索gradle如下圖配置:
解決方案:①找銀行負責POS對接的人員要USB驅動安裝后重啟電腦,再adb devices ②百度:https://www.jianshu.com/p/5d5397768cba
--解決方案:卸載原來的app,再安裝- --NDK版本不對應
ANDROID_SDK_ROOT=undefined (recommended setting)- 使用cordova命令報的錯
- Cordova 版本問題
解決辦法,升級cordova到V10.0.0
18.調起支付功能提示沒有權限
解決辦法:在Android studio里打開項目進入到app/src/main/AndroidManifest.xml里