Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ead5b1c2
Unverified
Commit
ead5b1c2
authored
Mar 31, 2022
by
Gary Qian
Committed by
GitHub
Mar 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retire v1 embedding compatibility from automatic multidex support (#100685)
parent
1a072f9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
7 deletions
+48
-7
multidex.dart
packages/flutter_tools/lib/src/android/multidex.dart
+13
-3
multidex_test.dart
...utter_tools/test/general.shard/android/multidex_test.dart
+28
-2
multidex_project.dart
...ls/test/integration.shard/test_data/multidex_project.dart
+7
-2
No files found.
packages/flutter_tools/lib/src/android/multidex.dart
View file @
ead5b1c2
...
...
@@ -25,25 +25,35 @@ File _getMultiDexApplicationFile(Directory projectDir) {
void
ensureMultiDexApplicationExists
(
final
Directory
projectDir
)
{
final
File
applicationFile
=
_getMultiDexApplicationFile
(
projectDir
);
if
(
applicationFile
.
existsSync
())
{
return
;
// This checks for instances of legacy versions of this file. Legacy versions maintained
// compatibility with v1 embedding by extending FlutterApplication. If we detect this,
// we replace the file with the modern v2 embedding version.
if
(
applicationFile
.
readAsStringSync
().
contains
(
'android.app.Application;'
))
{
return
;
}
}
applicationFile
.
createSync
(
recursive:
true
);
final
StringBuffer
buffer
=
StringBuffer
();
buffer
.
write
(
'''
// Generated file.
//
// If you wish to remove Flutter'
s
multidex
support
,
delete
this
entire
file
.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.
package
io
.
flutter
.
app
;
import
android
.
app
.
Application
;
import
android
.
content
.
Context
;
import
androidx
.
annotation
.
CallSuper
;
import
androidx
.
multidex
.
MultiDex
;
/**
* Extension of {@link
io.flutter.app.Flutter
Application}, adding multidex support.
* Extension of {@link
android.app.
Application}, adding multidex support.
*/
public
class
FlutterMultiDexApplication
extends
Flutter
Application
{
public
class
FlutterMultiDexApplication
extends
Application
{
@Override
@CallSuper
protected
void
attachBaseContext
(
Context
base
)
{
...
...
packages/flutter_tools/test/general.shard/android/multidex_test.dart
View file @
ead5b1c2
...
...
@@ -14,7 +14,7 @@ import '../../src/common.dart';
import
'../../src/context.dart'
;
void
main
(
)
{
testUsingContext
(
'ensureMultidexUtilsExists
returns when exists
'
,
()
async
{
testUsingContext
(
'ensureMultidexUtilsExists
patches file when invalid
'
,
()
async
{
final
Directory
directory
=
globals
.
fs
.
currentDirectory
;
final
File
applicationFile
=
directory
.
childDirectory
(
'android'
)
.
childDirectory
(
'app'
)
...
...
@@ -32,7 +32,33 @@ void main() {
ensureMultiDexApplicationExists
(
directory
);
// File should remain untouched
expect
(
applicationFile
.
readAsStringSync
(),
'hello'
);
expect
(
applicationFile
.
readAsStringSync
(),
'''
// Generated file.
//
// If you wish to remove Flutter'
s
multidex
support
,
delete
this
entire
file
.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.
package
io
.
flutter
.
app
;
import
android
.
app
.
Application
;
import
android
.
content
.
Context
;
import
androidx
.
annotation
.
CallSuper
;
import
androidx
.
multidex
.
MultiDex
;
/**
* Extension of {@link android.app.Application}, adding multidex support.
*/
public
class
FlutterMultiDexApplication
extends
Application
{
@Override
@CallSuper
protected
void
attachBaseContext
(
Context
base
)
{
super
.
attachBaseContext
(
base
);
MultiDex
.
install
(
this
);
}
}
''');
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
...
...
packages/flutter_tools/test/integration.shard/test_data/multidex_project.dart
View file @
ead5b1c2
...
...
@@ -298,18 +298,23 @@ class MultidexProject extends Project {
String
get
appMultidexApplication
=>
r''
'
// Generated file.
//
// If you wish to remove Flutter'
s
multidex
support
,
delete
this
entire
file
.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.
package
io
.
flutter
.
app
;
import
android
.
app
.
Application
;
import
android
.
content
.
Context
;
import
androidx
.
annotation
.
CallSuper
;
import
androidx
.
multidex
.
MultiDex
;
/**
* Extension of {@link
io.flutter.app.Flutter
Application}, adding multidex support.
* Extension of {@link
android.app.
Application}, adding multidex support.
*/
public
class
FlutterMultiDexApplication
extends
Flutter
Application
{
public
class
FlutterMultiDexApplication
extends
Application
{
@Override
@CallSuper
protected
void
attachBaseContext
(
Context
base
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment