Flutter Plugin开发问题集~持续更新

Android插件

问题1: aar报错: Direct local .aar file dependencies are not supported when building an AAR.
  • 解决: 在plugin项目中的build.gradle中:
android {
    repositories {
        flatDir {
            dirs 'libs'  // aar dir
        }
    }
}
dependencies {
  provided files('libs/xxx.aar') // aar file
}
问题2: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx$Methodxxx" on path: ......
  • 解决:在Flutter主项目中./android/app/build.grade中添加:
android {
      repositories {
        flatDir {
            dirs project(':plugin_name').file('libs'), // plugin_name自行替换
        }
    }
}
问题3: Calling startActivity() from outside of an Activity? context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

当无法直接设置intent时,尝试将当前的上下文对象转化为activity,因为我们知道:Context中有一个startActivity方法,Activity继承自Context,重载了startActivity方法。如果使用Activity的startActivity方法,不会有任何限制. 原文链接

你可能感兴趣的:(Flutter Plugin开发问题集~持续更新)