小编Mat*_*jaz的帖子

Flutter包依赖不加载它自己的资产

我们有以下结构:

project A (hosted on private git). It has it's asset folder and is loading assets like this: Image.asset("images/Logo_png_1080x1080px.png")
project B, that uses project A as dependency
Run Code Online (Sandbox Code Playgroud)

项目 A 是一个 flutter 应用程序,可构建 ios 和 android 应用程序。它功能齐全,一切都按预期进行。

现在我们遇到的问题是项目 B。

项目 B 包含简单的入门类,它设置项目 A 正在使用的一些基本属性,并且一旦我们设法正确执行它,就会设置它自己的图标。它还将生产 ios 和 android 应用程序。

当我们启动应用程序时,没有识别到​​任何资产(图像),并且出现异常:

I/flutter ( 7290):
  Unable to load asset: images/Logo_png_1080x1080px.png
I/flutter ( 7290):
I/flutter ( 7290):
  When the exception was thrown, this was the stack:
I/flutter ( 7290): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:224:7)
I/flutter ( 7290): …
Run Code Online (Sandbox Code Playgroud)

assets flutter

2
推荐指数
1
解决办法
1920
查看次数

标签 统计

assets ×1

flutter ×1