安装环境版本:JDK7.-JDK 8 Andriod SDK 10 flutter 版本 3.0
1.当创建完后flutter工程后会遇到 run gradle task assemlble Debug 的问题,需要设置远程仓库,共需要修改三个地方build.gradle两处以及flutter 下面的D:\FVM\versions\3.0.0\packages\flutter_tools\gradle\flutter.gradle(自己相关flutter目录)文件:
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url "https://maven.aliyun.com/repository/central" }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
![在这里插入图片描述](https://img-blog.csdnimg.cn/ba666ffe0fff4572a3a8ad01355017e3.png
buildscript {
repositories {
// google()
// mavenCentral()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url "https://maven.aliyun.com/repository/central" }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
}
dependencies {
/* When bumping, also update ndkVersion above. */
classpath 'com.android.tools.build:gradle:7.4'
}
}
2.一些常用命理:
flutter doctor 检测环境
flutter doctor --android-licenses 检测版本问题
flutter create
创建工程(可用andriod studio创建工程),
flutter create -t module flutter_module
创建具体的开发工程
, cd flutter_module
and run flutter pub get
获取所需要包
3.按照中遇到问题
3.*未解决问题:查到的资料有说grade版本太高,可低版本的资源也下不到。暂未找到解决办法,有解决的可以留言。
。
** dependencies {
/ When bumping, also update ndkVersion above. */
// classpath ‘com.android.tools.build:gradle:7.4.2’
classpath ‘com.android.tools.build:gradle:7.1.2’
}
Caused by: groovy.lang.MissingPropertyException: No such property: FD_INTERMEDIATES for class: com.android.builder.model.AndroidProject,
后改问题应该是build.gradle里设置的grade版本和flutter.gradle里设置的版本不一直造成的,修改一致后未出现该问题
4.flutter.gradleSDK版本和下载的sdk版本不一致问题,我目前最高版本SDK 29.
FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
Failed to install the following SDK components:
platforms;android-31 Android SDK Platform 31
Install the missing components using the SDK manager in Android Studio.
当我修改了相关版本后依然错误,所以flutter3.0要求的SDK应该为31版本。
下载31版本的SDK和SDK tools
配置好以后,不再出现该问题。
5.新问题,
Performing Streamed Install
adb: failed to install D:\project\flutter1\build\app\outputs\flutter-apk\app.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
Error launching application on MI 8.
重新插拔了下usb,手机,然后该问题没了。运行成功。