Целевая версия SDK не поддерживается в Cordova 10

#android #cordova #android-sdk-2.3

Вопрос:

Когда мы пытаемся изменить целевую версию sdk с 29 на 30. Мы получили следующую ошибку.

 This should work as is when targeting API 28 (now forbidden by Google Play) This should work when targeting API 29 with the dev version of the plugin (which has the android:requestLegacyExternalStorage="true"), alternatively you can use the edit-config to add this flag. This won't work when targeting API 30, as API 30 ignores the android:requestLegacyExternalStorage attribute. It's important to read the Android Notes before you target API 30. You may need to migrate your files to another folder to maintain access to them when targeting API 30 using the new APIs.  

Есть ли какое — либо решение для решения этой проблемы. Заранее спасибо!

Ответ №1:

Потратив два дня, мы получили одно такое решение для этой проблемы с внешним хранилищем API 30 уровня в кордове.

Я внес небольшие изменения в CordovaActivity.java в функции init ().

 protected void init() { appView = makeWebView(); createViews(); if (!appView.isInitialized()) { appView.init(cordovaInterface, pluginEntries, preferences); } /********** MODIFICATION SDK 30 **********/ WebView webView = (SystemWebView)(appView.getEngine().getView()); WebSettings webSettings = webView.getSettings(); webSettings.setAllowFileAccess(true); /**********************************/ cordovaInterface.onCordovaInit(appView.getPluginManager()); // Wire the hardware volume controls to control media if desired. String volumePref = preferences.getString("DefaultVolumeStream", ""); if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) { setVolumeControlStream(AudioManager.STREAM_MUSIC); } }  

Комментарии:

1. это сработало. Спасибо!