When you create a Flutter project with Android Stduio, there will be all sorts of weird potholes, one after another. Finally, when you compile the Flutter project, it will keep saying Running Gradle Task ‘assembleDebug’ and then stop. A problem with flutter Could not resolve IO. Flutter is caused by the failure of the web to access Google services. There are two solutions:
I. FQ, no problem to solve the problem;
2. Modify the image.
The specific steps are as follows:
1. To findFlutte SDK
In the directoryFlutter
Packaging configuration filesflutter.gradle
Path for flutter \ packages \ flutter_tools \ gradle \ flutter gradle
-
Modify the configuration in step 1
buildscript {
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'}}Copy the code
-
Modify configuration 2
apply plugin: FlutterPlugin
class FlutterPlugin implements Plugin<Project> {
// private static final String MAVEN_REPO = "https://storage.googleapis.com/download.flutter.io";
private static final String MAVEN_REPO = "https://storage.flutter-io.cn/download.flutter.io";
// The platforms that can be passed to the `--Ptarget-platform` flag.
private static final String PLATFORM_ARM32 = "android-arm";
private static final String PLATFORM_ARM64 = "android-arm64";
private static final String PLATFORM_X86 = "android-x86";
private static final String PLATFORM_X86_64 = "android-x64";
// The ABI architectures.
private static final String ARCH_ARM32 = "armeabi-v7a";
private static final String ARCH_ARM64 = "arm64-v8a";
private static final String ARCH_X86 = "x86";
private static final String ARCH_X86_64 = "x86_64";
Copy the code
-
Modify configuration 3
void addFlutterDependencies(buildType) {
String flutterBuildMode = buildModeFor(buildType)
if(! supportsBuildMode(flutterBuildMode)) {return
}
String repository = useLocalEngine()
? project.property('local-engine-repo')
: MAVEN_REPO
project.rootProject.allprojects {
repositories {
maven {
url repository
}
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'}}}Copy the code
2. ModifyFlutter
Under the project ofandroid
Under thebuild.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' }
}
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'}}}Copy the code
After modifying the image, you should be able to rebuild.