gpt4 book ai didi

android - ionic +快车道 |安卓 "error: package android.support.v4.content does not exist"

转载 作者:行者123 更新时间:2023-12-04 23:54:51 32 4
gpt4 key购买 nike

我有一个我正在使用的 Ionic 项目在构建 Android 时遇到了麻烦。我继承了这个项目,所以我不是 100% 熟悉 快车道 以及它是如何构建java文件的。此外,我在 WSL2 上并使用 sdkmanager 和以下已安装的软件包:

Installed packages:=====================] 100% Fetch remote repository...
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;29.0.2 | 29.0.2 | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2
emulator | 30.8.4 | Android Emulator | emulator
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4
platform-tools | 31.0.3 | Android SDK Platform-Tools | platform-tools
platforms;android-29 | 5 | Android SDK Platform 29 | platforms/android-29
当我运行 bundle exec fastlane android build它做了很多魔术,但最终导致以下错误:
> Task :app:compileReleaseJavaWithJavac FAILED
/home/zonyx/git/gitlab/studio/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java:42: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
/home/zonyx/git/gitlab/studio/platforms/android/app/src/main/java/org/apache/cordova/camera/FileProvider.java:21: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}
^
/home/zonyx/git/gitlab/studio/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java:297: error: cannot find symbol
this.imageUri = FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
/home/zonyx/git/gitlab/studio/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java:824: error: cannot find symbol
Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
我看到了一些关于使用 androidx.core.content.FileProvider 的较新 SDK 版本的想法。而不是 android.support.v4.content.FileProvider .由于整个 Android 部分是自动构建/生成的,我显然无法更改 java 文件,因为它只会被覆盖。
这是 中的一行快速文件 这可能会有所帮助:
desc 'Compile a new build for Android'
lane :build do |options|
Dir.chdir('..') do
before_build(options)
ionic_build
sh("ionic cordova build android --device --release --aot false --environment prod --output-hashing all \
--sourcemaps false --extract-css true --named-chunks false --build-optimizer true --minifyjs=true \
--minifycss=true --optimizejs=true")
deeplinks(action: 'uninstall')
end
end

最佳答案

cordova-plugin-androidx-adapter将自动迁移旧库以使用 AndroidX 支持库。我相信当您针对 Android 10 或更高版本(即进行切换时)时需要这样做。一旦您的所有插件都支持 AndroidX,您就可以删除适配器插件。

关于android - ionic +快车道 |安卓 "error: package android.support.v4.content does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69215970/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com