From 8e231796272f7f14391ca9c6b40392bc20f96aeb Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 20 Sep 2019 13:37:10 -0700 Subject: [PATCH] Revert "Use AndroidX in new projects by default (#40925)" (#40995) --- .../android_host_app/app/build.gradle | 4 ++-- .../main/java/io/flutter/add2app/MainActivity.java | 2 +- .../android_host_app/gradle.properties | 3 --- .../module_host_with_custom_build/app/build.gradle | 2 +- .../java/io/flutter/addtoapp/MainActivity.java | 2 +- .../gradle.properties | 3 --- .../flutter_tools/lib/src/commands/create.dart | 4 ++-- .../test/general.shard/commands/create_test.dart | 14 +++++++------- 8 files changed, 14 insertions(+), 20 deletions(-) diff --git a/dev/integration_tests/android_host_app/app/build.gradle b/dev/integration_tests/android_host_app/app/build.gradle index 7ac8837690..e95f399283 100644 --- a/dev/integration_tests/android_host_app/app/build.gradle +++ b/dev/integration_tests/android_host_app/app/build.gradle @@ -14,11 +14,11 @@ android { targetSdkVersion 28 versionCode 1 versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } } dependencies { implementation project(':flutter') - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.android.support:appcompat-v7:27.1.1' } diff --git a/dev/integration_tests/android_host_app/app/src/main/java/io/flutter/add2app/MainActivity.java b/dev/integration_tests/android_host_app/app/src/main/java/io/flutter/add2app/MainActivity.java index 8acc10cf0b..1c3ead7a99 100644 --- a/dev/integration_tests/android_host_app/app/src/main/java/io/flutter/add2app/MainActivity.java +++ b/dev/integration_tests/android_host_app/app/src/main/java/io/flutter/add2app/MainActivity.java @@ -1,7 +1,7 @@ package io.flutter.add2app; +import android.support.v7.app.AppCompatActivity; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import io.flutter.facade.Flutter; public class MainActivity extends AppCompatActivity { diff --git a/dev/integration_tests/android_host_app/gradle.properties b/dev/integration_tests/android_host_app/gradle.properties index 015c76e2af..6ed0f8f960 100644 --- a/dev/integration_tests/android_host_app/gradle.properties +++ b/dev/integration_tests/android_host_app/gradle.properties @@ -1,4 +1 @@ org.gradle.jvmargs=-Xmx1536m - -android.useAndroidX=true -android.enableJetifier=true diff --git a/dev/integration_tests/module_host_with_custom_build/app/build.gradle b/dev/integration_tests/module_host_with_custom_build/app/build.gradle index 9b7fdfb541..254d777b3f 100644 --- a/dev/integration_tests/module_host_with_custom_build/app/build.gradle +++ b/dev/integration_tests/module_host_with_custom_build/app/build.gradle @@ -39,5 +39,5 @@ android { dependencies { implementation project(':flutter') - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.android.support:appcompat-v7:27.1.1' } diff --git a/dev/integration_tests/module_host_with_custom_build/app/src/main/java/io/flutter/addtoapp/MainActivity.java b/dev/integration_tests/module_host_with_custom_build/app/src/main/java/io/flutter/addtoapp/MainActivity.java index 1f5b2a2bd4..60bb318ab4 100644 --- a/dev/integration_tests/module_host_with_custom_build/app/src/main/java/io/flutter/addtoapp/MainActivity.java +++ b/dev/integration_tests/module_host_with_custom_build/app/src/main/java/io/flutter/addtoapp/MainActivity.java @@ -1,7 +1,7 @@ package io.flutter.addtoapp; +import android.support.v7.app.AppCompatActivity; import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; import io.flutter.facade.Flutter; public class MainActivity extends AppCompatActivity { diff --git a/dev/integration_tests/module_host_with_custom_build/gradle.properties b/dev/integration_tests/module_host_with_custom_build/gradle.properties index 015c76e2af..6ed0f8f960 100644 --- a/dev/integration_tests/module_host_with_custom_build/gradle.properties +++ b/dev/integration_tests/module_host_with_custom_build/gradle.properties @@ -1,4 +1 @@ org.gradle.jvmargs=-Xmx1536m - -android.useAndroidX=true -android.enableJetifier=true diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index 4c35620d0b..2e5ad130d9 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart @@ -141,7 +141,7 @@ class CreateCommand extends FlutterCommand { argParser.addFlag( 'androidx', negatable: true, - defaultsTo: true, + defaultsTo: false, help: 'Generate a project using the AndroidX support libraries', ); // Deprecated @@ -398,7 +398,7 @@ class CreateCommand extends FlutterCommand { final String relativeDirPath = fs.path.relative(projectDirPath); if (!projectDir.existsSync() || projectDir.listSync().isEmpty) { - printStatus('Creating project $relativeDirPath... androidx: ${argResults['androidx']}'); + printStatus('Creating project $relativeDirPath...'); } else { if (sampleCode != null && !argResults['overwrite']) { throwToolExit('Will not overwrite existing project in $relativeDirPath: ' diff --git a/packages/flutter_tools/test/general.shard/commands/create_test.dart b/packages/flutter_tools/test/general.shard/commands/create_test.dart index 5d859be34f..41afc630ba 100644 --- a/packages/flutter_tools/test/general.shard/commands/create_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/create_test.dart @@ -410,7 +410,7 @@ void main() { }, timeout: allowForRemotePubInvocation); - testUsingContext('androidx is used by default in an app project', () async { + testUsingContext('androidx app project', () async { Cache.flutterRoot = '../..'; when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision); when(mockFlutterVersion.channel).thenReturn(frameworkChannel); @@ -418,7 +418,7 @@ void main() { final CreateCommand command = CreateCommand(); final CommandRunner runner = createTestCommandRunner(command); - await runner.run(['create', '--no-pub', projectDir.path]); + await runner.run(['create', '--no-pub', '--androidx', projectDir.path]); void expectExists(String relPath) { expect(fs.isFileSync('${projectDir.path}/$relPath'), true); @@ -452,7 +452,7 @@ void main() { expect(actualContents.contains('useAndroidX'), false); }, timeout: allowForCreateFlutterProject); - testUsingContext('androidx is used by default in a module project', () async { + testUsingContext('androidx app module', () async { Cache.flutterRoot = '../..'; when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision); when(mockFlutterVersion.channel).thenReturn(frameworkChannel); @@ -460,7 +460,7 @@ void main() { final CreateCommand command = CreateCommand(); final CommandRunner runner = createTestCommandRunner(command); - await runner.run(['create', '--template=module', '--no-pub', projectDir.path]); + await runner.run(['create', '--template=module', '--no-pub', '--androidx', projectDir.path]); final FlutterProject project = FlutterProject.fromDirectory(projectDir); expect( @@ -469,7 +469,7 @@ void main() { ); }, timeout: allowForCreateFlutterProject); - testUsingContext('non androidx module', () async { + testUsingContext('non androidx app module', () async { Cache.flutterRoot = '../..'; when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision); when(mockFlutterVersion.channel).thenReturn(frameworkChannel); @@ -486,7 +486,7 @@ void main() { ); }, timeout: allowForCreateFlutterProject); - testUsingContext('androidx is used by default in a plugin project', () async { + testUsingContext('androidx plugin project', () async { Cache.flutterRoot = '../..'; when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision); when(mockFlutterVersion.channel).thenReturn(frameworkChannel); @@ -494,7 +494,7 @@ void main() { final CreateCommand command = CreateCommand(); final CommandRunner runner = createTestCommandRunner(command); - await runner.run(['create', '--no-pub', '--template=plugin', projectDir.path]); + await runner.run(['create', '--no-pub', '--template=plugin', '--androidx', projectDir.path]); void expectExists(String relPath) { expect(fs.isFileSync('${projectDir.path}/$relPath'), true);