<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flutter &#8211; 张三太爷</title>
	<atom:link href="https://www.somedoc.net/category/flutter/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.somedoc.net</link>
	<description>看前面，黑洞洞</description>
	<lastBuildDate>Fri, 10 Mar 2023 09:42:04 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.1</generator>

<image>
	<url>https://www.somedoc.net/wp-content/uploads/2016/12/cropped-dandycheung-1-32x32.jpg</url>
	<title>Flutter &#8211; 张三太爷</title>
	<link>https://www.somedoc.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Flutter 应用如何取消对某系统平台的支持</title>
		<link>https://www.somedoc.net/2023/03/09/flutter-%e5%ba%94%e7%94%a8%e5%a6%82%e4%bd%95%e5%8f%96%e6%b6%88%e5%af%b9%e6%9f%90%e7%b3%bb%e7%bb%9f%e5%b9%b3%e5%8f%b0%e7%9a%84%e6%94%af%e6%8c%81/</link>
					<comments>https://www.somedoc.net/2023/03/09/flutter-%e5%ba%94%e7%94%a8%e5%a6%82%e4%bd%95%e5%8f%96%e6%b6%88%e5%af%b9%e6%9f%90%e7%b3%bb%e7%bb%9f%e5%b9%b3%e5%8f%b0%e7%9a%84%e6%94%af%e6%8c%81/#respond</comments>
		
		<dc:creator><![CDATA[张三太爷]]></dc:creator>
		<pubDate>Thu, 09 Mar 2023 12:46:59 +0000</pubDate>
				<category><![CDATA[Flutter]]></category>
		<category><![CDATA[技术]]></category>
		<guid isPermaLink="false">https://www.somedoc.net/?p=5432</guid>

					<description><![CDATA[今天要从手机上拉一个 app 的安装包到电脑上，计划用曾贡献 <a href="https://www.somedoc.net/2023/03/09/flutter-%e5%ba%94%e7%94%a8%e5%a6%82%e4%bd%95%e5%8f%96%e6%b6%88%e5%af%b9%e6%9f%90%e7%b3%bb%e7%bb%9f%e5%b9%b3%e5%8f%b0%e7%9a%84%e6%94%af%e6%8c%81/" class="more-link">[&#8230;]</a>]]></description>
										<content:encoded><![CDATA[<p>今天要从手机上拉一个 app 的安装包到电脑上，计划用曾贡献过代码的一个 Flutter 写就的工具来做。谁知在枚举手机 app 的列表界面竟然没有任何内容，显然什么地方有 bug 了。于是到命令行下先把代码更新到最新，想尝试编译一下看是否最新的版本会自动消除这一问题。不想项目的依赖发生了变化，用 <code>flutter pub get</code> 更新时有要求必须先 <code>flutter upgrade</code> 更新 SDK。</p>
<p>SDK 更新完毕后，<code>flutter build windows</code> 开始编译，它自动会先执行 <code>flutter pub get</code>，但依赖更新后却出来一下提示：</p>
<blockquote><p>This app is using a deprecated version of the Android embedding.<br />
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.<br />
Take a look at the docs for migrating an app:<br />
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects<br />
The plugin <code>package_info_plus</code> requires your app to be migrated to the Android embedding v2. Follow the steps on the<br />
migration doc above and re-run this command.</p></blockquote>
<p>看上去是如果 app 要运行在 Android 下的话，应该要做的一个迁移工作。然而这个项目是个桌面类型的，所以第一时间的反应是我把对 Android 平台的支持去掉不就得了嘛。于是执行了 <code>flutter config --no-enable-android</code> 后再次编译，提示依然；执行 <code>flutter clean</code> 后再次编译，提示依然！</p>
<p>目前还不知道可以怎么办，只好先把这个过程记录下来。</p>
<hr />
<p>更新（2023-03-10）：</p>
<p>看了官方的迁移说明页，以及网上很多的解决此问题的记录，感觉都跟我的情况不符。尤其是，我去 android 目录中去查看，并没有那些 Activity 啊 Manifest 啊之类的项目文件被生成。这很好理解，因为它本来就不是个 Android 项目。前文的去除对 Android 平台的支持的尝试，就是怕 flutter 在某些工程文件中记录了此平台是要支持 Android 平台的，从而触发了检查。</p>
<p>看来想多了，现在触发检查的并非配置，而是另有其物。看来看去，只能是项目根目录下这个名叫 android 的子目录了，动手把它删除后再执行编译构建命令，果然一马平川了。</p>
<p>问题终结。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.somedoc.net/2023/03/09/flutter-%e5%ba%94%e7%94%a8%e5%a6%82%e4%bd%95%e5%8f%96%e6%b6%88%e5%af%b9%e6%9f%90%e7%b3%bb%e7%bb%9f%e5%b9%b3%e5%8f%b0%e7%9a%84%e6%94%af%e6%8c%81/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Flutter 工程编译时几个小问题的解决</title>
		<link>https://www.somedoc.net/2022/02/20/flutter-%e5%b7%a5%e7%a8%8b%e7%bc%96%e8%af%91%e6%97%b6%e4%b8%a4%e4%b8%aa%e5%b0%8f%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3/</link>
					<comments>https://www.somedoc.net/2022/02/20/flutter-%e5%b7%a5%e7%a8%8b%e7%bc%96%e8%af%91%e6%97%b6%e4%b8%a4%e4%b8%aa%e5%b0%8f%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3/#respond</comments>
		
		<dc:creator><![CDATA[张三太爷]]></dc:creator>
		<pubDate>Sun, 20 Feb 2022 08:30:32 +0000</pubDate>
				<category><![CDATA[Flutter]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[问题解决]]></category>
		<guid isPermaLink="false">https://www.somedoc.net/?p=4960</guid>

					<description><![CDATA[听闻 Flutter 最新的版本已经将 Windows 纳为 <a href="https://www.somedoc.net/2022/02/20/flutter-%e5%b7%a5%e7%a8%8b%e7%bc%96%e8%af%91%e6%97%b6%e4%b8%a4%e4%b8%aa%e5%b0%8f%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3/" class="more-link">[&#8230;]</a>]]></description>
										<content:encoded><![CDATA[<p>听闻 Flutter 最新的版本已经将 Windows 纳为其官方正式支持的目标平台，找了个例子项目来编译一下看一眼。</p>
<p>Flutter 的版本是 2.10.2 稳定版。编译时报了一个错，形如 <code>Error: Member not found: ’packageRoot’</code> 这样。找的解决办法在<a href="https://www.fluttercampus.com/guide/270/error-member-not-found-packageroot-flutter/">这儿</a>，按照其中所述的方法一，执行 <code>flutter pub upgrade</code> 后就好了。纳闷的是，我明明新装的 flutter 怎么还需要升级缓存。</p>
<p>编译之后的运行环节也出了一个问题，<code>Can't load AOT data from C:\Examples\flutter_windows_11\build\windows\runner\Debug\data\app.so; no such file.</code>。解决方案在<a href="https://github.com/flutter/flutter/issues/97814">这儿</a>，见 irufano 的回复。看上去像是构建过程的一个小 bug。</p>
<p>然后，想编译出 Android 版本来对比一下观感上的异同，又出了几个问题。第一个是说 <code>build.gradle</code> 里指定的 <code>1.3.50</code> 版本的 kotlin 编译器下载不成功，用梯子解决后又说 <code>One or more plugins require a higher Android SDK version.</code>，逼得我把工程的 <code>compileSdkVersion</code> 从 <code>30</code> 提升到了 <code>31</code>；再然后又是这样的错误信息，<code>/.gradle/caches/transforms-3/02690cd4e51ccc293ebc0625df834aff/transformed/jetified-kotlinx-coroutines-core-jvm-1.5.2.jar!/M<br />
ETA-INF/kotlinx-coroutines-core.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its<br />
metadata is 1.5.1, expected version is 1.1.15.</code>，好在控制台输出信息中有解决方案如下，</p>
<blockquote><p></p><pre class="crayon-plain-tag">┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────┐
           │ [!] Your project requires a newer version of the Kotlin Gradle plugin.                              │
           │ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update │
           │ C:\Examples\flutter_windows_11\android\build.gradle:                                                │
           │ ext.kotlin_version = '<latest-version>'                                                             │
           └─────────────────────────────────────────────────────────────────────────────────────────────────────┘</pre><p></p></blockquote>
<p>照此将 kotlin 的版本号从 <code>1.3.50</code> 升级到了 <code>1.6.10</code>（同时还把 gradle build tools 的版本从 <code>4.1.0</code> 升级到了我本地已经使用过的较新版本 <code>7.0.4</code> 上，以及相应地把 <code>gradle-wrapper.properties</code> 文件中 gradle 的版本从 <code>6.7</code> 也改为了本地已经有缓存的 <code>7.0.2</code>），然后出问题的画风就恢复成 <code>Could not get resource<br />
'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.6.10/kotlin-compiler-embeddable-1.6.10.jar'</code>，而且不知何故，这次连梯子也救不了，只好手动下载后，放到了用户目录下的相应位置（<code>$USER_HOME\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-compiler-embeddable\1.6.10\acf7f6fbb7ee87f4653cc6a3bc868670e1a9c541</code>）。</p>
<p>此番过后，总算顺利通过，在测试机上运行成功。实属不易。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.somedoc.net/2022/02/20/flutter-%e5%b7%a5%e7%a8%8b%e7%bc%96%e8%af%91%e6%97%b6%e4%b8%a4%e4%b8%aa%e5%b0%8f%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
