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
5dabe102
Unverified
Commit
5dabe102
authored
Jan 24, 2023
by
Gary Qian
Committed by
GitHub
Jan 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix path name to discover debug apk on add2app builds (#117999)
parent
d20dd9e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
1 deletion
+90
-1
application_package.dart
...es/flutter_tools/lib/src/android/application_package.dart
+7
-1
application_package_test.dart
...er_tools/test/general.shard/application_package_test.dart
+83
-0
No files found.
packages/flutter_tools/lib/src/android/application_package.dart
View file @
5dabe102
...
...
@@ -115,7 +115,13 @@ class AndroidApk extends ApplicationPackage implements PrebuiltApplicationPackag
}
if
(
androidProject
.
isUsingGradle
&&
androidProject
.
isSupportedVersion
)
{
apkFile
=
getApkDirectory
(
androidProject
.
parent
).
childFile
(
filename
);
Directory
apkDirectory
=
getApkDirectory
(
androidProject
.
parent
);
if
(
androidProject
.
parent
.
isModule
)
{
// Module builds output the apk in a subdirectory that corresponds
// to the buildmode of the apk.
apkDirectory
=
apkDirectory
.
childDirectory
(
buildInfo
!.
mode
.
name
);
}
apkFile
=
apkDirectory
.
childFile
(
filename
);
if
(
apkFile
.
existsSync
())
{
// Grab information from the .apk. The gradle build script might alter
// the application Id, so we need to look at what was actually built.
...
...
packages/flutter_tools/test/general.shard/application_package_test.dart
View file @
5dabe102
...
...
@@ -55,6 +55,73 @@ void main() {
).
path
).
createSync
(
recursive:
true
);
});
testUsingContext
(
'correct debug filename in module projects'
,
()
async
{
const
String
aaptPath
=
'aaptPath'
;
final
File
apkFile
=
globals
.
fs
.
file
(
'app-debug.apk'
);
final
FakeAndroidSdkVersion
sdkVersion
=
FakeAndroidSdkVersion
();
sdkVersion
.
aaptPath
=
aaptPath
;
sdk
.
latestVersion
=
sdkVersion
;
sdk
.
platformToolsAvailable
=
true
;
sdk
.
licensesAvailable
=
false
;
fakeProcessManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
aaptPath
,
'dump'
,
'xmltree'
,
apkFile
.
path
,
'AndroidManifest.xml'
,
],
stdout:
_aaptDataWithDefaultEnabledAndMainLauncherActivity
)
);
fakeProcessManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
aaptPath
,
'dump'
,
'xmltree'
,
fs
.
path
.
join
(
'module_project'
,
'build'
,
'host'
,
'outputs'
,
'apk'
,
'debug'
,
'app-debug.apk'
),
'AndroidManifest.xml'
,
],
stdout:
_aaptDataWithDefaultEnabledAndMainLauncherActivity
)
);
await
ApplicationPackageFactory
.
instance
!.
getPackageForPlatform
(
TargetPlatform
.
android_arm
,
applicationBinary:
apkFile
,
);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
FlutterProject
project
=
await
aModuleProject
();
project
.
android
.
hostAppGradleRoot
.
childFile
(
'build.gradle'
).
createSync
(
recursive:
true
);
final
File
appGradle
=
project
.
android
.
hostAppGradleRoot
.
childFile
(
fs
.
path
.
join
(
'app'
,
'build.gradle'
));
appGradle
.
createSync
(
recursive:
true
);
appGradle
.
writeAsStringSync
(
"def flutterPluginVersion = 'managed'"
);
final
File
apkDebugFile
=
project
.
directory
.
childDirectory
(
'build'
)
.
childDirectory
(
'host'
)
.
childDirectory
(
'outputs'
)
.
childDirectory
(
'apk'
)
.
childDirectory
(
'debug'
)
.
childFile
(
'app-debug.apk'
);
apkDebugFile
.
createSync
(
recursive:
true
);
final
AndroidApk
?
androidApk
=
await
AndroidApk
.
fromAndroidProject
(
project
.
android
,
androidSdk:
sdk
,
processManager:
fakeProcessManager
,
userMessages:
UserMessages
(),
processUtils:
ProcessUtils
(
processManager:
fakeProcessManager
,
logger:
logger
),
logger:
logger
,
fileSystem:
fs
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
null
,
treeShakeIcons:
false
),
);
expect
(
androidApk
,
isNotNull
);
},
overrides:
overrides
);
testUsingContext
(
'Licenses not available, platform and buildtools available, apk exists'
,
()
async
{
const
String
aaptPath
=
'aaptPath'
;
final
File
apkFile
=
globals
.
fs
.
file
(
'app-debug.apk'
);
...
...
@@ -895,3 +962,19 @@ class FakeAndroidSdkVersion extends Fake implements AndroidSdkVersion {
@override
late
String
aaptPath
;
}
Future
<
FlutterProject
>
aModuleProject
()
async
{
final
Directory
directory
=
globals
.
fs
.
directory
(
'module_project'
);
directory
.
childDirectory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'{"configVersion":2,"packages":[]}'
);
directory
.
childFile
(
'pubspec.yaml'
).
writeAsStringSync
(
'''
name: my_module
flutter:
module:
androidPackage: com.example
'''
);
return
FlutterProject
.
fromDirectory
(
directory
);
}
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