果皮皮 - flutter
type: channel
link: http://guopi.xin/tag/flutter/
items: Flutter - 给App增加启动屏幕(Splash Screen)并且设置背景颜色
items: flutter ios pod install 报错
items: flutter File 写入文件失败问题
items: Flutter release包运行闪退
items: Flutter Android Gradle plugin requires Java 11 to run.
items: flutter 卡 Running Gradle task 'assembleDebug'
items: Flutter 跳转到系统设置等界面实现
items: Flutter android:label 冲突解决

Flutter - 给App增加启动屏幕(Splash Screen)并且设置背景颜色
type: item
date: 2022-12-27T17:53:23+08:00
description: 打开android\app\src\main\res\drawable\launch_background.xml,<?xml version="1.0" encoding="utf-8"?> <bitmap android:gravity="center" android:src="@mipmap/launch_image" /> 将里面的内容反注释，并且准备一张图片分辨率1080 x 1920,放入android\app\src\main\res\mipmap-xxhdpi即可。注意名字改成launch_image即可。或者你可以用别的名字，把上面的xml文件改一下即可关于背景颜色，这个也是研究了一段时间，因为Android自带的颜色只有white和black。想自定义颜色，却一直引用不到。后来翻了很多资料和so上的回答，才发现自己马虎大意。需要把原来的 @android:color/white”中的android:去掉即可。去掉以后为 其中orange是自定义的颜色。首先需要在android\app\src\main\res\values下新建一个colors.xml文件，内容为<?xml version="1.0" encoding="utf-8"?> #FFAB40 #00000000 中间的resources就是自己想要添加的颜色。话说Android真是不给力，连个颜色都不预置。定义好以后就可以在launch_background.xml中引用了。

flutter ios pod install 报错
type: item
date: 2022-12-10T16:59:00+08:00
description: 类似报错:LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443解决方案：方法1.打开终端在终端中执行以下命令就可以了。git config --global --add remote.origin.proxy ""方法2.若第一种方法输入命令不管用，可以尝试先输入下边命令，然后在执行第一种方法的命令。步骤一：git config --global http.sslBackend "openssl"步骤二：git config --global --add remote.origin.proxy ""

flutter File 写入文件失败问题
type: item
date: 2022-09-26T21:35:38+08:00
description: File 写入文件出错：FileSystemException: Cannot create file, path = '/storage/emulated/0/Download/xxx.pdf' (OS Error: File exists, errno = 13)出错机型：华为 nova 5 proAndroid 10解决方案：AndroidManifest.xml<application ... android:requestLegacyExternalStorage="true" >

Flutter release包运行闪退
type: item
date: 2022-06-26T22:51:03+08:00
description: Flutter从1.12开始 ，默认开启了混淆的 会遇到app闪退的情况，把它关闭即可，如果要用混淆的话，自行查阅 flutter 混淆的配置，开启混淆只是减少无用资源和代码压缩使安装包更小 开启状态需要配置规则文件才可避免闪退 不是很熟悉的话关闭就行了。android app目录下bulid.gradle配置signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } buildTypes { release { signingConfig signingConfigs.release //关闭混淆 minifyEnabled false //删除无用代码 shrinkResources false //删除无用资源 } }

Flutter Android Gradle plugin requires Java 11 to run.
type: item
date: 2022-06-20T22:54:34+08:00
description: 1、安装java112、在Android项目下的gradle.properties文件里面添加了下面解决了org.gradle.java.home=D:\\Program Files\\Java\\jdk-11.0.12把java的路径替换为自己的

flutter 卡 Running Gradle task 'assembleDebug'
type: item
date: 2021-03-23T18:18:00+08:00
description: flutter 运行项目，卡在：Running Gradle task 'assembleDebug'解决方案:1.修改项目中android/build.gradle文件buildscript { ext.kotlin_version = '1.3.50' repositories { //google() //jcenter() maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } maven {url 'http://download.flutter.io'} } dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { //google() //jcenter() maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } maven {url 'http://download.flutter.io'} } }可以试着运行下看效果，如果还不行，继续修改2.修改Flutter的配置文件, 该文件在Flutter安装目该文件在 Flutter安装目录/packages/flutter_tools/gradle/flutter.gradlebuildscript { repositories { //google() //jcenter() maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.5.0' } }

Flutter 跳转到系统设置等界面实现
type: item
date: 2020-11-02T00:50:00+08:00
description: MainActivity.java导入：import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import android.content.Intent; import android.os.Bundle;增加通道名称变量：private static final String CHANNEL = "toSetting";增加onCreate方法@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new MethodChannel(getFlutterEngine().getDartExecutor().getBinaryMessenger(), CHANNEL).setMethodCallHandler( new MethodCallHandler() { @Override public void onMethodCall(MethodCall call, Result result) { if(call.method.equals("to")){ Intent intent = new Intent(); intent.setAction(call.arguments.toString()); startActivity(intent); }else{ result.notImplemented(); } } } ); }完整代码示例：package com.example.chat; import io.flutter.embedding.android.FlutterActivity; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import android.content.Intent; import android.os.Bundle; public class MainActivity extends FlutterActivity { private static final String CHANNEL = "ToSetting"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new MethodChannel(getFlutterEngine().getDartExecutor().getBinaryMessenger(), CHANNEL).setMethodCallHandler( new MethodCallHandler() { @Override public void onMethodCall(MethodCall call, Result result) { if(call.method.equals("to")){ Intent intent = new Intent(); intent.setAction(call.arguments.toString()); startActivity(intent); }else{ result.notImplemented(); } } } ); } }Flutter中使用：static const platform = const MethodChannel('ToSetting'); platform.invokeMethod('to','android.settings.MEMORY_CARD_SETTINGS');

Flutter android:label 冲突解决
type: item
date: 2020-11-01T20:02:00+08:00
description: Flutter android:label 冲突解决错误如下：F:\Flutter\chat\android\app\src\debug\AndroidManifest.xml:11:9-27 Error: Attribute application@label value=(����) from AndroidManifest.xml:11:9-27 is also present at [com.tencent.imsdk:imsdk:4.6.1] AndroidManifest.xml:18:9-41 value=(@string/app_name). FAILURE: Build failed with an exception.大概意思就是我引入的插件里也包含android:label，导致冲突解决方法：AndroidManifest.xmlmanifest 引入 xmlns:tools="http://schemas.android.com/tools"application 加入 tools:replace="android:label"完整配置： <uses-permission android:name="android.permission.INTERNET" /> <meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" /> <meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" /> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> <meta-data android:name="flutterEmbedding" android:value="2" />