mirror of
https://github.com/flutter/flutter
synced 2024-09-20 00:32:02 +00:00
Remove v1 Android create templates (#61203)
This commit is contained in:
parent
eac1747169
commit
8bd2e6585b
|
@ -13,8 +13,6 @@ import 'package:path/path.dart' as path;
|
|||
final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
|
||||
final String gradlewExecutable = Platform.isWindows ? '.\\$gradlew' : './$gradlew';
|
||||
|
||||
final bool useAndroidEmbeddingV2 = Platform.environment['ENABLE_ANDROID_EMBEDDING_V2'] == 'true';
|
||||
|
||||
/// Tests that the Android app containing a Flutter module can be built when
|
||||
/// it has custom build types and flavors.
|
||||
Future<void> main() async {
|
||||
|
@ -60,7 +58,7 @@ Future<void> main() async {
|
|||
flutterDirectory.path,
|
||||
'dev',
|
||||
'integration_tests',
|
||||
useAndroidEmbeddingV2 ? 'module_host_with_custom_build_v2_embedding' : 'module_host_with_custom_build',
|
||||
'module_host_with_custom_build_v2_embedding',
|
||||
),
|
||||
),
|
||||
hostAppDir,
|
||||
|
|
|
@ -14,8 +14,6 @@ final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
|
|||
final String gradlewExecutable = Platform.isWindows ? '.\\$gradlew' : './$gradlew';
|
||||
final String fileReadWriteMode = Platform.isWindows ? 'rw-rw-rw-' : 'rw-r--r--';
|
||||
|
||||
final bool useAndroidEmbeddingV2 = Platform.environment['ENABLE_ANDROID_EMBEDDING_V2'] == 'true';
|
||||
|
||||
/// Tests that the Flutter module project template works and supports
|
||||
/// adding Flutter to an existing Android app.
|
||||
Future<void> main() async {
|
||||
|
@ -177,7 +175,7 @@ Future<void> main() async {
|
|||
flutterDirectory.path,
|
||||
'dev',
|
||||
'integration_tests',
|
||||
useAndroidEmbeddingV2 ? 'android_host_app_v2_embedding' : 'android_host_app',
|
||||
'android_host_app_v2_embedding',
|
||||
),
|
||||
),
|
||||
hostApp,
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# Android host app
|
||||
|
||||
Android host app for a Flutter module created using
|
||||
```
|
||||
$ flutter create -t module hello
|
||||
```
|
||||
and placed in a sibling folder to (a clone of) the host app.
|
||||
Used by the `module_test.dart` device lab test.
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.flutter.add2app"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':flutter')
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style license that can be
|
||||
found in the LICENSE file. -->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.flutter.add2app">
|
||||
|
||||
<application android:allowBackup="false"
|
||||
tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon">
|
||||
<activity android:name=".MainActivity" />
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.add2app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import io.flutter.facade.Flutter;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(Flutter.createView(this, getLifecycle(), "route1"));
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
org.gradle.jvmargs=-Xmx1536m
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
|
@ -1,6 +0,0 @@
|
|||
#Mon Jun 25 14:13:36 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
|
@ -1,7 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
include ':app'
|
||||
setBinding(new Binding([gradle: this]))
|
||||
evaluate(new File(settingsDir.parentFile, 'hello/.android/include_flutter.groovy'))
|
|
@ -1,8 +0,0 @@
|
|||
# Android host app
|
||||
|
||||
Android host app for a Flutter module created using
|
||||
```
|
||||
$ flutter create -t module hello
|
||||
```
|
||||
and placed in a sibling folder to (a clone of) the host app.
|
||||
Used by the `module_host_with_custom_build_test.dart` device lab test.
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
defaultConfig {
|
||||
applicationId "io.flutter.addtoapp"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
// Test build types.
|
||||
buildTypes {
|
||||
staging {
|
||||
initWith debug
|
||||
// This is required because the `:flutter` project doesn't define this custom build type.
|
||||
// Without the fallback, the Android plugin will make Gradle exit with the following error:
|
||||
// `Unable to find a matching variant of project :flutter`
|
||||
matchingFallbacks = ['debug']
|
||||
}
|
||||
prod {
|
||||
initWith release
|
||||
matchingFallbacks = ['release']
|
||||
}
|
||||
}
|
||||
// Test flavors.
|
||||
flavorDimensions "version"
|
||||
productFlavors {
|
||||
demo {
|
||||
dimension "version"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':flutter')
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style license that can be
|
||||
found in the LICENSE file. -->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.flutter.addtoapp">
|
||||
|
||||
<application android:allowBackup="false"
|
||||
tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon">
|
||||
<activity android:name=".MainActivity" />
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.addtoapp;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import io.flutter.facade.Flutter;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(Flutter.createView(this, getLifecycle(), "route1"));
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
org.gradle.jvmargs=-Xmx1536m
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
|
@ -1,6 +0,0 @@
|
|||
#Mon Jun 25 14:13:36 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
|
@ -1,7 +0,0 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
include ':app'
|
||||
setBinding(new Binding([gradle: this]))
|
||||
evaluate(new File(settingsDir.parentFile, 'hello/.android/include_flutter.groovy'))
|
|
@ -748,7 +748,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl
|
|||
'macosIdentifier': appleIdentifier,
|
||||
'description': projectDescription,
|
||||
'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
|
||||
'useAndroidEmbeddingV2': featureFlags.isAndroidEmbeddingV2Enabled,
|
||||
'androidMinApiLevel': android_common.minApiLevel,
|
||||
'androidSdkVersion': android_sdk.minimumAndroidSdkVersion,
|
||||
'withDriverTest': renderDriverTest,
|
||||
|
|
|
@ -34,9 +34,6 @@ class FeatureFlags {
|
|||
/// Whether flutter desktop for Windows is enabled.
|
||||
bool get isWindowsEnabled => isEnabled(flutterWindowsDesktopFeature);
|
||||
|
||||
/// Whether the Android embedding V2 is enabled.
|
||||
bool get isAndroidEmbeddingV2Enabled => isEnabled(flutterAndroidEmbeddingV2Feature);
|
||||
|
||||
/// Whether a particular feature is enabled for the current channel.
|
||||
///
|
||||
/// Prefer using one of the specific getters above instead of this API.
|
||||
|
@ -68,7 +65,6 @@ const List<Feature> allFeatures = <Feature>[
|
|||
flutterLinuxDesktopFeature,
|
||||
flutterMacOSDesktopFeature,
|
||||
flutterWindowsDesktopFeature,
|
||||
flutterAndroidEmbeddingV2Feature,
|
||||
];
|
||||
|
||||
/// The [Feature] for flutter web.
|
||||
|
@ -131,29 +127,6 @@ const Feature flutterWindowsDesktopFeature = Feature(
|
|||
),
|
||||
);
|
||||
|
||||
/// The [Feature] for generating projects using the new Android embedding.
|
||||
const Feature flutterAndroidEmbeddingV2Feature = Feature(
|
||||
name: 'flutter create generates projects using the Android embedding V2',
|
||||
environmentOverride: 'ENABLE_ANDROID_EMBEDDING_V2',
|
||||
configSetting: 'enable-android-embedding-v2',
|
||||
beta: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: true,
|
||||
),
|
||||
dev: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: true,
|
||||
),
|
||||
master: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: true,
|
||||
),
|
||||
stable: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: true,
|
||||
),
|
||||
);
|
||||
|
||||
/// A [Feature] is a process for conditionally enabling tool features.
|
||||
///
|
||||
/// All settings are optional, and if not provided will generally default to
|
||||
|
|
|
@ -644,6 +644,12 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
|
|||
break;
|
||||
case AndroidEmbeddingVersion.v1:
|
||||
default:
|
||||
globals.printStatus(
|
||||
'Your Flutter application is created using an older version of the '
|
||||
"Android embedding. It's being deprecated in favor of Android embedding "
|
||||
'v2. Follow the steps on https://flutter.dev/go/android-project-migration '
|
||||
'to migrate your project.'
|
||||
);
|
||||
for (final Map<String, dynamic> plugin in androidPlugins) {
|
||||
if (!(plugin['supportsEmbeddingV1'] as bool) && plugin['supportsEmbeddingV2'] as bool) {
|
||||
throwToolExit(
|
||||
|
|
|
@ -805,7 +805,7 @@ class AndroidProject extends FlutterProjectPlatform {
|
|||
await _overwriteFromTemplate(globals.fs.path.join(
|
||||
'module',
|
||||
'android',
|
||||
featureFlags.isAndroidEmbeddingV2Enabled ? 'library_new_embedding' : 'library',
|
||||
'library_new_embedding',
|
||||
), ephemeralDirectory);
|
||||
await _overwriteFromTemplate(globals.fs.path.join('module', 'android', 'gradle'), ephemeralDirectory);
|
||||
gradle.gradleUtils.injectGradleWrapperIfNeeded(ephemeralDirectory);
|
||||
|
@ -820,7 +820,6 @@ class AndroidProject extends FlutterProjectPlatform {
|
|||
'projectName': parent.manifest.appName,
|
||||
'androidIdentifier': parent.manifest.androidPackage,
|
||||
'androidX': usesAndroidX,
|
||||
'useAndroidEmbeddingV2': featureFlags.isAndroidEmbeddingV2Enabled,
|
||||
},
|
||||
printStatusWhenWriting: false,
|
||||
overwriteExisting: true,
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
package {{androidIdentifier}};
|
||||
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
import io.flutter.embedding.android.FlutterActivity;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
{{^useAndroidEmbeddingV2}}
|
||||
import android.os.Bundle;
|
||||
import io.flutter.app.FlutterActivity;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
GeneratedPluginRegistrant.registerWith(this);
|
||||
}
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
|
|
|
@ -1,20 +1,6 @@
|
|||
package {{androidIdentifier}}
|
||||
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
{{^useAndroidEmbeddingV2}}
|
||||
import android.os.Bundle
|
||||
import io.flutter.app.FlutterActivity
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
GeneratedPluginRegistrant.registerWith(this)
|
||||
}
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
|
|
|
@ -16,16 +16,6 @@
|
|||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
{{^useAndroidEmbeddingV2}}
|
||||
<!-- This keeps the window background of the activity showing
|
||||
until Flutter renders its first frame. It can be removed if
|
||||
there is no splash screen (such as the default splash screen
|
||||
defined in @style/LaunchTheme). -->
|
||||
<meta-data
|
||||
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
|
||||
android:value="true" />
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
|
@ -43,18 +33,15 @@
|
|||
android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
||||
android:resource="@drawable/launch_background"
|
||||
/>
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -36,12 +36,10 @@
|
|||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
package {{androidIdentifier}}.host;
|
||||
|
||||
import android.os.Bundle;
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
import io.flutter.embedding.android.FlutterActivity;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
{{^useAndroidEmbeddingV2}}
|
||||
import io.flutter.app.FlutterActivity;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
GeneratedPluginRegistrant.registerWith(this);
|
||||
}
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
// Generated file. Do not edit.
|
||||
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = new File(buildscript.sourceFile.parentFile.parentFile, 'local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
group '{{androidIdentifier}}'
|
||||
version '1.0'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 28
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":flutter" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":flutter" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Generated file. Do not edit. -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="{{androidIdentifier}}"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application tools:node="merge">
|
||||
<meta-data
|
||||
android:name="flutterProjectType"
|
||||
android:value="module" />
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,130 +0,0 @@
|
|||
package io.flutter.facade;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
|
||||
import io.flutter.plugin.common.BasicMessageChannel;
|
||||
import io.flutter.plugin.common.StringCodec;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
import io.flutter.view.FlutterMain;
|
||||
import io.flutter.view.FlutterNativeView;
|
||||
import io.flutter.view.FlutterRunArguments;
|
||||
import io.flutter.view.FlutterView;
|
||||
|
||||
/**
|
||||
* Main entry point for using Flutter in Android applications.
|
||||
*
|
||||
* <p><strong>Warning:</strong> This file is auto-generated by Flutter tooling.
|
||||
* DO NOT EDIT.</p>
|
||||
*/
|
||||
public final class Flutter {
|
||||
private Flutter() {
|
||||
// to prevent instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the Dart VM. Calling this method at an early point may help decreasing time to first
|
||||
* frame for a subsequently created {@link FlutterView}.
|
||||
*
|
||||
* @param applicationContext the application's {@link Context}
|
||||
*/
|
||||
public static void startInitialization(@NonNull Context applicationContext) {
|
||||
FlutterMain.startInitialization(applicationContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link FlutterFragment} managing a {@link FlutterView}. The optional
|
||||
* initial route string will be made available to the Dart code
|
||||
* (via {@code window.defaultRouteName}) and may be used to determine which widget
|
||||
* should be displayed in the view. The default initialRoute is "/".
|
||||
*
|
||||
* @param initialRoute an initial route {@link String}, or null
|
||||
* @return a {@link FlutterFragment}
|
||||
*/
|
||||
@NonNull
|
||||
public static FlutterFragment createFragment(String initialRoute) {
|
||||
final FlutterFragment fragment = new FlutterFragment();
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(FlutterFragment.ARG_ROUTE, initialRoute);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link FlutterView} linked to the specified {@link Activity} and {@link Lifecycle}.
|
||||
* The optional initial route string will be made available to the Dart code (via
|
||||
* {@code window.defaultRouteName}) and may be used to determine which widget should be displayed
|
||||
* in the view. The default initialRoute is "/".
|
||||
*
|
||||
* @param activity an {@link Activity}
|
||||
* @param lifecycle a {@link Lifecycle}
|
||||
* @param initialRoute an initial route {@link String}, or null
|
||||
* @return a {@link FlutterView}
|
||||
*/
|
||||
@NonNull
|
||||
public static FlutterView createView(@NonNull final Activity activity, @NonNull final Lifecycle lifecycle, final String initialRoute) {
|
||||
FlutterMain.startInitialization(activity.getApplicationContext());
|
||||
FlutterMain.ensureInitializationComplete(activity.getApplicationContext(), null);
|
||||
final FlutterNativeView nativeView = new FlutterNativeView(activity);
|
||||
final FlutterView flutterView = new FlutterView(activity, null, nativeView) {
|
||||
private final BasicMessageChannel<String> lifecycleMessages = new BasicMessageChannel<>(this, "flutter/lifecycle", StringCodec.INSTANCE);
|
||||
@Override
|
||||
public void onFirstFrame() {
|
||||
super.onFirstFrame();
|
||||
setAlpha(1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostResume() {
|
||||
// Overriding default behavior to avoid dictating system UI via PlatformPlugin.
|
||||
lifecycleMessages.send("AppLifecycleState.resumed");
|
||||
}
|
||||
};
|
||||
if (initialRoute != null) {
|
||||
flutterView.setInitialRoute(initialRoute);
|
||||
}
|
||||
lifecycle.addObserver(new LifecycleObserver() {
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
|
||||
public void onCreate() {
|
||||
final FlutterRunArguments arguments = new FlutterRunArguments();
|
||||
arguments.bundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
|
||||
arguments.entrypoint = "main";
|
||||
flutterView.runFromBundle(arguments);
|
||||
GeneratedPluginRegistrant.registerWith(flutterView.getPluginRegistry());
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_START)
|
||||
public void onStart() {
|
||||
flutterView.onStart();
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||
public void onResume() {
|
||||
flutterView.onPostResume();
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
|
||||
public void onPause() {
|
||||
flutterView.onPause();
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
||||
public void onStop() {
|
||||
flutterView.onStop();
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||
public void onDestroy() {
|
||||
flutterView.destroy();
|
||||
}
|
||||
});
|
||||
flutterView.setAlpha(0.0f);
|
||||
return flutterView;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package io.flutter.facade;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import io.flutter.view.FlutterView;
|
||||
|
||||
/**
|
||||
* A {@link Fragment} managing a {@link FlutterView}.
|
||||
*
|
||||
* <p><strong>Warning:</strong> This file is auto-generated by Flutter tooling.
|
||||
* DO NOT EDIT.</p>
|
||||
*/
|
||||
public class FlutterFragment extends Fragment {
|
||||
public static final String ARG_ROUTE = "route";
|
||||
private String mRoute = "/";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mRoute = getArguments().getString(ARG_ROUTE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
|
||||
super.onInflate(context, attrs, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlutterView onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return Flutter.createView(getActivity(), getLifecycle(), mRoute);
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
def scriptFile = getClass().protectionDomain.codeSource.location.toURI()
|
||||
def flutterProjectRoot = new File(scriptFile).parentFile.parentFile
|
||||
|
||||
gradle.include ":flutter"
|
||||
gradle.project(":flutter").projectDir = new File(flutterProjectRoot, ".android/Flutter")
|
||||
|
||||
def localPropertiesFile = new File(flutterProjectRoot, ".android/local.properties")
|
||||
def properties = new Properties()
|
||||
|
||||
assert localPropertiesFile.exists(), "❗️The Flutter module doesn't have a `$localPropertiesFile` file." +
|
||||
"\nYou must run `flutter pub get` in `$flutterProjectRoot`."
|
||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
gradle.apply from: "$flutterSdkPath/packages/flutter_tools/gradle/module_plugin_loader.gradle"
|
|
@ -1,5 +0,0 @@
|
|||
// Generated file. Do not edit.
|
||||
|
||||
rootProject.name = 'android_generated'
|
||||
setBinding(new Binding([gradle: this]))
|
||||
evaluate(new File(settingsDir, 'include_flutter.groovy'))
|
|
@ -1,6 +1,5 @@
|
|||
package {{androidIdentifier}};
|
||||
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin;
|
||||
|
@ -24,20 +23,6 @@ public class {{pluginClass}} implements FlutterPlugin, MethodCallHandler {
|
|||
channel.setMethodCallHandler(this);
|
||||
}
|
||||
|
||||
// This static function is optional and equivalent to onAttachedToEngine. It supports the old
|
||||
// pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
|
||||
// plugin registration via this function while apps migrate to use the new Android APIs
|
||||
// post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
|
||||
//
|
||||
// It is encouraged to share logic between onAttachedToEngine and registerWith to keep
|
||||
// them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
|
||||
// depending on the user's project. onAttachedToEngine or registerWith must both be defined
|
||||
// in the same class.
|
||||
public static void registerWith(Registrar registrar) {
|
||||
final MethodChannel channel = new MethodChannel(registrar.messenger(), "{{projectName}}");
|
||||
channel.setMethodCallHandler(new {{pluginClass}}());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
|
||||
if (call.method.equals("getPlatformVersion")) {
|
||||
|
@ -52,29 +37,3 @@ public class {{pluginClass}} implements FlutterPlugin, MethodCallHandler {
|
|||
channel.setMethodCallHandler(null);
|
||||
}
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
{{^useAndroidEmbeddingV2}}
|
||||
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 io.flutter.plugin.common.PluginRegistry.Registrar;
|
||||
|
||||
/** {{pluginClass}} */
|
||||
public class {{pluginClass}} implements MethodCallHandler {
|
||||
/** Plugin registration. */
|
||||
public static void registerWith(Registrar registrar) {
|
||||
final MethodChannel channel = new MethodChannel(registrar.messenger(), "{{projectName}}");
|
||||
channel.setMethodCallHandler(new {{pluginClass}}());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMethodCall(MethodCall call, Result result) {
|
||||
if (call.method.equals("getPlatformVersion")) {
|
||||
result.success("Android " + android.os.Build.VERSION.RELEASE);
|
||||
} else {
|
||||
result.notImplemented();
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package {{androidIdentifier}}
|
||||
|
||||
{{#useAndroidEmbeddingV2}}
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin
|
||||
|
@ -23,23 +22,6 @@ public class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
|
|||
channel.setMethodCallHandler(this);
|
||||
}
|
||||
|
||||
// This static function is optional and equivalent to onAttachedToEngine. It supports the old
|
||||
// pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
|
||||
// plugin registration via this function while apps migrate to use the new Android APIs
|
||||
// post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
|
||||
//
|
||||
// It is encouraged to share logic between onAttachedToEngine and registerWith to keep
|
||||
// them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
|
||||
// depending on the user's project. onAttachedToEngine or registerWith must both be defined
|
||||
// in the same class.
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun registerWith(registrar: Registrar) {
|
||||
val channel = MethodChannel(registrar.messenger(), "{{projectName}}")
|
||||
channel.setMethodCallHandler({{pluginClass}}())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
|
||||
if (call.method == "getPlatformVersion") {
|
||||
result.success("Android ${android.os.Build.VERSION.RELEASE}")
|
||||
|
@ -52,29 +34,3 @@ public class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
|
|||
channel.setMethodCallHandler(null)
|
||||
}
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
{{^useAndroidEmbeddingV2}}
|
||||
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 io.flutter.plugin.common.PluginRegistry.Registrar
|
||||
|
||||
class {{pluginClass}}: MethodCallHandler {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun registerWith(registrar: Registrar) {
|
||||
val channel = MethodChannel(registrar.messenger(), "{{projectName}}")
|
||||
channel.setMethodCallHandler({{pluginClass}}())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMethodCall(call: MethodCall, result: Result) {
|
||||
if (call.method == "getPlatformVersion") {
|
||||
result.success("Android ${android.os.Build.VERSION.RELEASE}")
|
||||
} else {
|
||||
result.notImplemented()
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/useAndroidEmbeddingV2}}
|
||||
|
|
|
@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart';
|
|||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/commands/packages.dart';
|
||||
import 'package:flutter_tools/src/dart/pub.dart';
|
||||
import 'package:flutter_tools/src/features.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:process/process.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
|
@ -293,13 +292,21 @@ void main() {
|
|||
arguments: <String>['--no-pub']);
|
||||
removeGeneratedFiles(projectPath);
|
||||
|
||||
final File androidManifest = globals.fs.file(globals.fs.path.join(
|
||||
projectPath,
|
||||
'android/app/src/main/AndroidManifest.xml',
|
||||
));
|
||||
final String updatedAndroidManifestString =
|
||||
androidManifest.readAsStringSync().replaceAll('android:value="2"', 'android:value="1"');
|
||||
|
||||
androidManifest.writeAsStringSync(updatedAndroidManifestString);
|
||||
|
||||
final PackagesCommand command = await runCommandIn(projectPath, 'get');
|
||||
final PackagesGetCommand getCommand = command.subcommands['get'] as PackagesGetCommand;
|
||||
|
||||
expect(await getCommand.usageValues,
|
||||
containsPair(CustomDimensions.commandPackagesAndroidEmbeddingVersion, 'v1'));
|
||||
}, overrides: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(isAndroidEmbeddingV2Enabled: false),
|
||||
Pub: () => Pub(
|
||||
fileSystem: globals.fs,
|
||||
logger: globals.logger,
|
||||
|
@ -321,7 +328,6 @@ void main() {
|
|||
expect(await getCommand.usageValues,
|
||||
containsPair(CustomDimensions.commandPackagesAndroidEmbeddingVersion, 'v2'));
|
||||
}, overrides: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(isAndroidEmbeddingV2Enabled: true),
|
||||
Pub: () => Pub(
|
||||
fileSystem: globals.fs,
|
||||
logger: globals.logger,
|
||||
|
|
|
@ -440,36 +440,6 @@ void main() {
|
|||
|
||||
expect(featureFlags.isWindowsEnabled, false);
|
||||
}));
|
||||
|
||||
group('isAndroidEmbeddingV2Enabled', () {
|
||||
test('is enabled on beta', () => testbed.run(() {
|
||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||
when<bool>(mockFlutterConfig.getValue('enable-android-embedding-v2') as bool).thenReturn(true);
|
||||
|
||||
expect(featureFlags.isAndroidEmbeddingV2Enabled, true);
|
||||
}));
|
||||
|
||||
test('is enabled on dev', () => testbed.run(() {
|
||||
when(mockFlutterVerion.channel).thenReturn('dev');
|
||||
when<bool>(mockFlutterConfig.getValue('enable-android-embedding-v2') as bool).thenReturn(true);
|
||||
|
||||
expect(featureFlags.isAndroidEmbeddingV2Enabled, true);
|
||||
}));
|
||||
|
||||
test('is enabled on master', () => testbed.run(() {
|
||||
when(mockFlutterVerion.channel).thenReturn('master');
|
||||
when<bool>(mockFlutterConfig.getValue('enable-android-embedding-v2') as bool).thenReturn(true);
|
||||
|
||||
expect(featureFlags.isAndroidEmbeddingV2Enabled, true);
|
||||
}));
|
||||
|
||||
test('is enabled on stable', () => testbed.run(() {
|
||||
when(mockFlutterVerion.channel).thenReturn('stable');
|
||||
when<bool>(mockFlutterConfig.getValue('enable-android-embedding-v2') as bool).thenReturn(true);
|
||||
|
||||
expect(featureFlags.isAndroidEmbeddingV2Enabled, true);
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ dependencies:
|
|||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||
});
|
||||
|
||||
testUsingContext('old embedding app uses a plugin that supports v1 and v2 embedding', () async {
|
||||
testUsingContext('old embedding app uses a plugin that supports v1 and v2 embedding works but shows a deprecation warning', () async {
|
||||
when(flutterProject.isModule).thenReturn(false);
|
||||
when(androidProject.getEmbeddingVersion()).thenReturn(AndroidEmbeddingVersion.v1);
|
||||
|
||||
|
@ -655,6 +655,7 @@ dependencies:
|
|||
expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant'));
|
||||
expect(registrant.readAsStringSync(),
|
||||
contains('UseBothEmbedding.registerWith(registry.registrarFor("plugin4.UseBothEmbedding"));'));
|
||||
expect(testLogger.statusText, contains('Follow the steps on https://flutter.dev/go/android-project-migration'));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
|
|
|
@ -724,7 +724,6 @@ class TestFeatureFlags implements FeatureFlags {
|
|||
this.isMacOSEnabled = false,
|
||||
this.isWebEnabled = false,
|
||||
this.isWindowsEnabled = false,
|
||||
this.isAndroidEmbeddingV2Enabled = false,
|
||||
});
|
||||
|
||||
@override
|
||||
|
@ -739,9 +738,6 @@ class TestFeatureFlags implements FeatureFlags {
|
|||
@override
|
||||
final bool isWindowsEnabled;
|
||||
|
||||
@override
|
||||
final bool isAndroidEmbeddingV2Enabled;
|
||||
|
||||
@override
|
||||
bool isEnabled(Feature feature) {
|
||||
switch (feature) {
|
||||
|
@ -753,8 +749,6 @@ class TestFeatureFlags implements FeatureFlags {
|
|||
return isMacOSEnabled;
|
||||
case flutterWindowsDesktopFeature:
|
||||
return isWindowsEnabled;
|
||||
case flutterAndroidEmbeddingV2Feature:
|
||||
return isAndroidEmbeddingV2Enabled;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue