@chapaevartem

После изменении версии android api с 23 до 19 cordova выдает ошибку deprecated API. Как решить?

С версией android-23 все работает, но нужно сделать поддержку андроид 4+ и пытаюсь сбилдить в другом API

ionic platform add android
он сразу делает версию 23.
Не нахожу - Как сразу добавить старую версия?

И после уменьшаю на старую
android update project --subprojects --path "platforms/android" --target android-19 --library "CordovaLib"

С команды он заменил вроде везде кроме файла AndroidManifest.xml
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />

тут тоже изменил руками на 19

После делаю build и выдает ошибки:
Error: cmd: Command failed with exit code 1 Error output:
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\CordovaClientCertRequest.java:25: error: cannot find symbol
import android.webkit.ClientCertRequest;
                     ^
  symbol:   class ClientCertRequest
  location: package android.webkit
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\CordovaClientCertRequest.java:32: error: cannot find symbol
    private final ClientCertRequest request;
                  ^
  symbol:   class ClientCertRequest
  location: class CordovaClientCertRequest
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\CordovaClientCertRequest.java:34: error: cannot find symbol
    public CordovaClientCertRequest(ClientCertRequest request) {
                                    ^
  symbol:   class ClientCertRequest
  location: class CordovaClientCertRequest
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:41: error: cannot find symbol
import android.webkit.PermissionRequest;
                     ^
  symbol:   class PermissionRequest
  location: package android.webkit
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:265: error: cannot find symbol
    public boolean onShowFileChooser(WebView webView, final ValueCallback<Uri[]
 filePathsCallback, final WebChromeClient.FileChooserParams fileChooserParams)


                                         ^
  symbol:   class FileChooserParams
  location: class WebChromeClient
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:285: error: cannot find symbol
    public void onPermissionRequest(final PermissionRequest request) {
                                          ^
  symbol:   class PermissionRequest
  location: class SystemWebChromeClient
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebViewClient.java:29: error: cannot find symbol
import android.webkit.ClientCertRequest;
                     ^
  symbol:   class ClientCertRequest
  location: package android.webkit
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebViewClient.java:116: error: cannot find symbol
    public void onReceivedClientCertRequest (WebView view, ClientCertRequest re
uest)
                                                           ^
  symbol:   class ClientCertRequest
  location: class SystemWebViewClient
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemCookieManager.java:35: error: cannot find symbol
    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                                  ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:263: error: cannot find symbol
    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                                  ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:283: error: cannot find symbol
    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                                  ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\CordovaInterfaceImpl.java:227: error: cannot find symbol
        getActivity().requestPermissions(permissions, mappedRequestCode);
                     ^
  symbol:   method requestPermissions(String[],int)
  location: class Activity
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\CordovaInterfaceImpl.java:232: error: cannot find symbol
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
                                                       ^
  symbol:   variable M
  location: class VERSION_CODES
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\CordovaInterfaceImpl.java:234: error: cannot find symbol
            int result = activity.checkSelfPermission(permission);
                                 ^
  symbol:   method checkSelfPermission(String)
  location: variable activity of type Activity
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\CordovaActivity.java:493: error: method does not override or imple
ent a method from a supertype
    @Override
    ^
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemCookieManager.java:43: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                                                        ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemCookieManager.java:44: error: cannot find symbol
            cookieManager.setAcceptThirdPartyCookies(webView, true);
                         ^
  symbol:   method setAcceptThirdPartyCookies(WebView,boolean)
  location: variable cookieManager of type CookieManager
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemCookieManager.java:65: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                                                        ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemCookieManager.java:66: error: cannot find symbol
            cookieManager.flush();
                         ^
  symbol:   method flush()
  location: variable cookieManager of type CookieManager
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:264: error: method does not over
ide or implement a method from a supertype
    @Override
    ^
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:271: error: cannot find symbol
                    Uri[] result = WebChromeClient.FileChooserParams.parseResul
(resultCode, intent);
                                                  ^
  symbol:   variable FileChooserParams
  location: class WebChromeClient
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebChromeClient.java:284: error: method does not over
ide or implement a method from a supertype
    @Override
    ^
E:\Documents\NetBeansProjects\butt.mod20\platforms\android\CordovaLib\src\org\a
ache\cordova\engine\SystemWebViewClient.java:114: error: method does not overri
e or implement a method from a supertype
    @Override
    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
23 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.


Как можно победить это?

РЕШЕНИЕ

Как всегда нужно читать документацию:
cordova.apache.org/docs/en/latest/platform_plugin_...
cordova platform add android@3.7.0 --save
  • Вопрос задан
  • 906 просмотров
Решения вопроса 1
@chapaevartem Автор вопроса
Как всегда нужно читать документацию:
cordova.apache.org/docs/en/latest/platform_plugin_...
cordova platform add android@3.7.0 --save
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы