【问题标题】:Getting error in my first flutter app while trying to run尝试运行时在我的第一个颤振应用程序中出错
【发布时间】:2019-10-16 06:59:36
【问题描述】:

我刚刚尝试使用颤振运行我的第一个 hello world 应用程序。但是当模拟器选择并点击运行时它显示错误。

这是我的代码:

import "package:flutter/material.dart";

void main()
{
  runApp(

      Center(child:Text("Hello world!", textDirection: TextDirection.ltr) ,)
  );
}

我得到的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> org/apache/commons/codec/binary/Base64

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

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
Finished with error: Gradle task assembleDebug failed with exit code 1

怎么了?怎么解决?

【问题讨论】:

标签: android gradle flutter


【解决方案1】:

根据此github issue,您只需将其添加到您的build.gradle 文件中:

 packagingOptions {
     pickFirst 'lib/x86/libc++_shared.so'
     pickFirst 'lib/arm64-v8a/libc++_shared.so'
     pickFirst 'lib/x86_64/libc++_shared.so'
     pickFirst 'lib/armeabi-v7a/libc++_shared.so'
 }

【讨论】:

    【解决方案2】:

    我遵循并测试了您的代码,我发现没有问题应用程序完全正常,完全没有错误 代码:

    import "package:flutter/material.dart";
    
    void main() {
      runApp(Center(
        child: Text("Hello world!", textDirection: TextDirection.ltr),
      ));
    }
    
    

    您可以尝试对您的 sdk/应用程序进行故障排除

    尝试运行命令flutter clean

    颤抖医生

    希望这可行,添加您的日志,以便我们在运行此命令后查看问题

    【讨论】:

    • 谢谢,但我尝试了 flutter clean 命令但仍然不起作用
    猜你喜欢
    • 2020-03-15
    • 2020-02-20
    • 2020-08-19
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    • 2019-05-29
    • 2021-11-03
    • 2021-09-20
    相关资源
    最近更新 更多