Flutter采坑日记

昨天在pub.dev上闲逛,发现一个挺有意思的程序包:photo_manager,决定尝试一下。

废话不多,直接上代码

flutter create flutterdemo01

然后用vscode打开,在终端运行:

flutter pub add photo_manager

安装包。

Widget build(BuildContext context) {
    PhotoManager.requestPermissionExtend();
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }

编译一下试试,经过漫长等待,终于。。。。。。。。。。。。。。。。。。报错了。

Execution failed for task ':photo_manager:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 23s
Exception: Gradle task assembleDebug failed with exit code 1

 

好吧,搜一下:photo_manager:compileDebugKotlin,还真有人踩过这个坑,

https://github.com/CaiJingLong/flutter_photo_manager/issues/561

 一步步来,还真的解决了,在此记录一下,希望对遇到同样问题的同学有所帮助。

posted @ 2021-07-27 10:59  魂殇  阅读(942)  评论(0)    收藏  举报