【问题标题】:Building a asset pack in a Ionic project in Android studio在 Android Studio 的 Ionic 项目中构建资产包
【发布时间】:2021-11-06 05:54:21
【问题描述】:

我最近将我唯一的 cordova 项目转换为使用 IonicCapacitor。 发布到应用商店发现我的应用太大(aab 格式),因为我的图片太多。 我了解我需要创建一个资产包。关于创建资产包的详细信息,我只能找到https://developer.android.com/guide/playcore/asset-delivery/integrate-native (谁有更好的信息?)。

完成这些步骤后,在 VS Code I ...

 > ionic build
 > ionic capacitor build

然后在 Android 工作室我做。

Menu | Build | Make Project 

我收到以下错误:

Build file 'C:\code\myco-match\android\build.gradle' line: 27

A problem occurred evaluating root project 'android'.
> Could not find method android() for arguments [build_19eh0vogqj489iczcfbatfj08$_run_closure2@69641835] on root project 'android' of type org.gradle.api.Project.

第 27 行是

android {
    assetPacks = [":species-images"]
}

我是否遗漏了构建步骤?

我是否在我的 gradle 配置中遗漏了什么?我对 gradle 不是很熟悉)。

我是否在最初的应用转换中忘记了某些内容?这是我的第一个科尔多瓦项目转换为我的第一个离子和电容器项目。

有什么想法吗?

【问题讨论】:

标签: android-gradle-plugin ionic3 capacitor


【解决方案1】:

问题是在我上面第一个链接的参考中,我误读了第 2 步。

https://developer.android.com/guide/playcore/asset-delivery/integrate-native

阅读以下堆栈溢出问题

Gradle sync failed: Could not find method android() for arguments on root project on android studio

Gabriele Mariotti 说海报“使用了错误的 build.gradle 文件。 不能在顶层文件中定义 android 块。”

查看说明第 4 步说“在项目的 app build.gradle 文件中” 我错误地更改了 顶级 build.gradle 文件。 第 7 步 列出 build.gradle,就像您更改它一样,但该列表项应该是 /app/build.gradle

现在我可以使用 android studio 构建和打包了。

【讨论】:

    猜你喜欢
    • 2019-01-06
    • 2014-08-28
    • 1970-01-01
    • 2018-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    相关资源
    最近更新 更多