sdk.dir=C:/Users/11/AppData/Local/AndroID/SdkFlutter.sdk=C:\src\Flutter\Flutter_windows_1.22.6-stable\Flutter最后,我们在androID/build.gradle文件中,编写读取Flutter.sdk的代码,最后使用compileOnly files依赖本地的Flutter库。
//获取local.propertIEs配置文件def localPropertIEs = new PropertIEs()def localPropertIEsfile = rootProject.file('local.propertIEs')if (localPropertIEsfile.exists()) { localPropertIEsfile.withReader('UTF-8') { reader -> localPropertIEs.load(reader) }}//获取Flutter的sdk路径def FlutterRoot = localPropertIEs.getProperty('Flutter.sdk')if (FlutterRoot == null) { throw new GradleException("Flutter SDK not found. define location with Flutter.sdk in the local.propertIEs file.")}dependencIEs { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" compileOnly files("$FlutterRoot/bin/cache/artifacts/engine/androID-arm/Flutter.jar") compileOnly 'androIDx.annotation:annotation:1.1.0'}
重新sync gradle即可,亲测有效。
总结以上是内存溢出为你收集整理的Flutter常见问题 —— 解决Android模块无法识别Flutter sdk源码问题全部内容,希望文章能够帮你解决Flutter常见问题 —— 解决Android模块无法识别Flutter sdk源码问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)