<small id='9LzZd'></small><noframes id='9LzZd'>

      <legend id='9LzZd'><style id='9LzZd'><dir id='9LzZd'><q id='9LzZd'></q></dir></style></legend>
      <tfoot id='9LzZd'></tfoot>

        <bdo id='9LzZd'></bdo><ul id='9LzZd'></ul>

    1. <i id='9LzZd'><tr id='9LzZd'><dt id='9LzZd'><q id='9LzZd'><span id='9LzZd'><b id='9LzZd'><form id='9LzZd'><ins id='9LzZd'></ins><ul id='9LzZd'></ul><sub id='9LzZd'></sub></form><legend id='9LzZd'></legend><bdo id='9LzZd'><pre id='9LzZd'><center id='9LzZd'></center></pre></bdo></b><th id='9LzZd'></th></span></q></dt></tr></i><div id='9LzZd'><tfoot id='9LzZd'></tfoot><dl id='9LzZd'><fieldset id='9LzZd'></fieldset></dl></div>

        迁移到 androidx 后 Ionic android 构建错误

        时间:2024-04-13
        • <bdo id='YNzjN'></bdo><ul id='YNzjN'></ul>
            <tbody id='YNzjN'></tbody>
          • <legend id='YNzjN'><style id='YNzjN'><dir id='YNzjN'><q id='YNzjN'></q></dir></style></legend>

                <small id='YNzjN'></small><noframes id='YNzjN'>

                <tfoot id='YNzjN'></tfoot>

                1. <i id='YNzjN'><tr id='YNzjN'><dt id='YNzjN'><q id='YNzjN'><span id='YNzjN'><b id='YNzjN'><form id='YNzjN'><ins id='YNzjN'></ins><ul id='YNzjN'></ul><sub id='YNzjN'></sub></form><legend id='YNzjN'></legend><bdo id='YNzjN'><pre id='YNzjN'><center id='YNzjN'></center></pre></bdo></b><th id='YNzjN'></th></span></q></dt></tr></i><div id='YNzjN'><tfoot id='YNzjN'></tfoot><dl id='YNzjN'><fieldset id='YNzjN'></fieldset></dl></div>
                  本文介绍了迁移到 androidx 后 Ionic android 构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个 ionic 3 项目.由于突然的构建问题,我不得不迁移到 androidx.我用 cordova-android@8.0.0 版本创建了 android 平台,我做了必要的但现在我在构建 android 平台时遇到了一些其他错误

                  I am working on an ionic 3 project.i had to migrate to androidx due to a sudden build issue. I created the android platform with cordova-android@8.0.0 version and i did the needful but now i'm getting some other errors while building the android platform

                  我用cordova-android 8.0.0版创建了android平台.

                  I created the android platform with cordova-android version 8.0.0.

                  在 gradle.properties 文件中添加以下行

                  Added below lines to gradle.properties file

                  android.useAndroidX=trueandroid.enableJetifier=true

                  android.useAndroidX=true android.enableJetifier=true

                  将插件更新到最新版本

                  这是我的 project.properties 文件

                  this is my project.properties file

                  target=android-28
                  android.library.reference.1=CordovaLib
                  android.library.reference.2=app
                  cordova.gradle.include.2=cordova-plugin-appsflyer-sdk/userapp-cordovaAF.gradle
                  cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.40.0
                  cordova.gradle.include.3=cordova-plugin-firebase/userapp-build.gradle
                  cordova.system.library.2=com.google.android.gms:play-services-tagmanager:+
                  cordova.system.library.10=com.google.firebase:firebase-core:17.0.0
                  cordova.system.library.11=com.google.firebase:firebase-messaging:19.0.0
                  cordova.system.library.12=com.google.firebase:firebase-config:18.0.0
                  cordova.system.library.13=com.google.firebase:firebase-perf:18.0.0
                  cordova.gradle.include.4=cordova-plugin-googlemaps/userapp-tbxml-android.gradle
                  cordova.gradle.include.5=cordova-plugin-googlemaps/userapp-apikey.gradle
                  cordova.system.library.7=com.google.android.gms:play-services-maps:15.0.1
                  cordova.system.library.8=com.google.android.gms:play-services-location:15.0.1
                  cordova.system.library.9=com.android.support:support-core-utils:27.+
                  cordova.system.library.10=com.mixpanel.android:mixpanel-android:5.6.0
                  cordova.system.library.11=com.google.android.gms:play-services-base:+
                  cordova.system.library.14=com.android.support:support-v4:28.+
                  cordova.system.library.15=com.android.support:appcompat-v7:28.+
                  cordova.system.library.3=com.android.support:support-v4:28.+
                  cordova.system.library.4=com.android.support:appcompat-v7:28.+
                  

                  当我现在构建项目时,我遇到了下面提到的错误

                  When i build the project now im getting below mentioned errors

                  error: cannot find symbol
                  import android.support.v4.app.ActivityCompat;
                                               ^
                   cannot find symbol
                  import android.support.v4.os.EnvironmentCompat;
                  
                  error: cannot find symbol
                            public void onConnectionFailed(@NonNull ConnectionResult result) {
                                                            ^
                  

                  任何帮助将不胜感激.谢谢

                  Any help would be much appreciated.Thanks

                  推荐答案

                  出现错误是因为您的 Android 项目包含引用 Android 支持库的 Java 源代码(可能是 Cordova 插件的形式),但您在你的项目.
                  AndroidX 和 Android 支持库不能同时存在于同一个 Android 项目中 - 这样做会导致诸如此类的构建失败.
                  从您的 project.properties 可以看出,支持库作为 Gradle 依赖项被拉入(例如 cordova.system.library.3=com.android.support:support-v4:28.+).

                  The errors are arising because your Android project contains Java source code (presumably in the form of Cordova plugins) which references the Android Support Library but you have enabled AndroidX in your project.
                  AndroidX and the Android Support Library cannot live side-by-side in the same Android project - doing so will lead to build failures such as this.
                  From your project.properties it can been seen that the Support Library is being pulled in as a Gradle dependency (e.g. cordova.system.library.3=com.android.support:support-v4:28.+).

                  AndroidX (Jetpack) 是 Android 支持库.
                  请注意,最新版本的 Play Services &Firebase 库.
                  支持库被许多现有插件使用,例如 cordova-plugin-firebase.

                  AndroidX (Jetpack) is the successor to the Android Support Library.
                  Note that AndroidX is now used by the latest versions of Play Services & Firebase libraries.
                  The Support library is used by many existing plugins such as cordova-plugin-firebase.

                  要解决此问题,请在您的 Cordova 项目中添加以下两个插件:

                  To resolve this issue, add the following two plugins your Cordova project:

                  • cordova-plugin-androidx 在 Android 项目中启用 AndroidX.
                  • cordova-plugin-androidx-adapter 动态修补源码使用支持库以使用 AndroidX 等效项并修补 Gradle 配置以将 Android 支持库引用替换为 AndroidX 等效项的任何插件.
                  • cordova-plugin-androidx to enable AndroidX in the Android project.
                  • cordova-plugin-androidx-adapter to dynamically patch the source code of any plugins using the Support Library to use the AndroidX equivalents and to patch the Gradle config to replace Android Support Library references with AndroidX equivalents.

                  有关测试项目中的工作示例,请参阅 我对这个 Github 问题的评论.

                  For a working example of this in a test project, see my comment on this Github issue.

                  注意:如果您使用的是 cordova-plugin-firebase 并遇到错误,您可以改用 my fork of that plugin 发布为cordova-plugin-firebasex 并已修复以解决由新 Firebase SDK 引起的问题.以下是最安全的迁移方式:

                  Note: if you are using cordova-plugin-firebase and encountering errors, you can instead use my fork of that plugin which is published as cordova-plugin-firebasex and is fixed to resolve issues caused by the new Firebase SDK. Here's the safest way to migrate:

                  rm -Rf platforms/android
                  cordova plugin rm cordova-plugin-firebase
                  rm -Rf plugins/ node_modules/
                  npm install
                  cordova plugin add cordova-plugin-firebasex
                  cordova platform add android
                  

                  这篇关于迁移到 androidx 后 Ionic android 构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 android 设备上运行的 Ionic Cordova 给出:找不到 apk 架构:arm build-type: 下一篇:如何在 java 和 xml 中传递自定义组件参数

                  相关文章

                  <legend id='9PiV0'><style id='9PiV0'><dir id='9PiV0'><q id='9PiV0'></q></dir></style></legend>
                2. <tfoot id='9PiV0'></tfoot>
                3. <i id='9PiV0'><tr id='9PiV0'><dt id='9PiV0'><q id='9PiV0'><span id='9PiV0'><b id='9PiV0'><form id='9PiV0'><ins id='9PiV0'></ins><ul id='9PiV0'></ul><sub id='9PiV0'></sub></form><legend id='9PiV0'></legend><bdo id='9PiV0'><pre id='9PiV0'><center id='9PiV0'></center></pre></bdo></b><th id='9PiV0'></th></span></q></dt></tr></i><div id='9PiV0'><tfoot id='9PiV0'></tfoot><dl id='9PiV0'><fieldset id='9PiV0'></fieldset></dl></div>
                  1. <small id='9PiV0'></small><noframes id='9PiV0'>

                        <bdo id='9PiV0'></bdo><ul id='9PiV0'></ul>