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
df465c77
Commit
df465c77
authored
Mar 07, 2019
by
Dan Field
Committed by
Jonah Williams
Mar 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fall-back to platform tools in Android SDK detection logic. (#28863)
parent
cd1b89c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
1 deletion
+40
-1
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+8
-0
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+2
-1
user_messages.dart
packages/flutter_tools/lib/src/base/user_messages.dart
+2
-0
application_package_test.dart
packages/flutter_tools/test/application_package_test.dart
+28
-0
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
df465c77
...
...
@@ -365,6 +365,14 @@ class AndroidSdk {
}
static
bool
validSdkDirectory
(
String
dir
)
{
return
sdkDirectoryHasLicneses
(
dir
)
||
sdkDirectoryHasPlatformTools
(
dir
);
}
static
bool
sdkDirectoryHasPlatformTools
(
String
dir
)
{
return
fs
.
isDirectorySync
(
fs
.
path
.
join
(
dir
,
'platform-tools'
));
}
static
bool
sdkDirectoryHasLicneses
(
String
dir
)
{
return
fs
.
isDirectorySync
(
fs
.
path
.
join
(
dir
,
'licenses'
));
}
...
...
packages/flutter_tools/lib/src/application_package.dart
View file @
df465c77
...
...
@@ -14,6 +14,7 @@ import 'base/context.dart';
import
'base/file_system.dart'
;
import
'base/os.dart'
show
os
;
import
'base/process.dart'
;
import
'base/user_messages.dart'
;
import
'build_info.dart'
;
import
'globals.dart'
;
import
'ios/ios_workflow.dart'
;
...
...
@@ -94,7 +95,7 @@ class AndroidApk extends ApplicationPackage {
factory
AndroidApk
.
fromApk
(
File
apk
)
{
final
String
aaptPath
=
androidSdk
?.
latestVersion
?.
aaptPath
;
if
(
aaptPath
==
null
)
{
printError
(
'Unable to locate the Android SDK; please run
\'
flutter doctor
\'
.'
);
printError
(
userMessages
.
aaptNotFound
);
return
null
;
}
...
...
packages/flutter_tools/lib/src/base/user_messages.dart
View file @
df465c77
...
...
@@ -115,6 +115,8 @@ class UserMessages {
String
get
androidStudioResetDir
=>
'Consider removing your android-studio-dir setting by running:
\n
'
'flutter config --android-studio-dir='
;
String
get
aaptNotFound
=>
'Could not locate aapt. Please ensure you have the Android buildtools installed.'
;
// Messages used in NoAndroidStudioValidator
String
androidStudioMissing
(
String
location
)
=>
...
...
packages/flutter_tools/test/application_package_test.dart
View file @
df465c77
...
...
@@ -65,6 +65,34 @@ void main() {
).
path
)..
createSync
(
recursive:
true
);
});
testUsingContext
(
'Licenses not available, platform and buildtools available, apk exists'
,
()
async
{
const
String
aaptPath
=
'aaptPath'
;
final
File
apkFile
=
fs
.
file
(
'app.apk'
);
final
AndroidSdkVersion
sdkVersion
=
MockitoAndroidSdkVersion
();
when
(
sdkVersion
.
aaptPath
).
thenReturn
(
aaptPath
);
when
(
sdk
.
latestVersion
).
thenReturn
(
sdkVersion
);
when
(
sdk
.
platformToolsAvailable
).
thenReturn
(
true
);
when
(
sdk
.
licensesAvailable
).
thenReturn
(
false
);
when
(
mockProcessManager
.
runSync
(
argThat
(
equals
(<
String
>[
aaptPath
,
'dump'
,
'xmltree'
,
apkFile
.
path
,
'AndroidManifest.xml'
,
])),
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
),
).
thenReturn
(
ProcessResult
(
0
,
0
,
_aaptDataWithDefaultEnabledAndMainLauncherActivity
,
null
));
final
ApplicationPackage
applicationPackage
=
await
ApplicationPackageFactory
.
instance
.
getPackageForPlatform
(
TargetPlatform
.
android_arm
,
applicationBinary:
apkFile
,
);
expect
(
applicationPackage
.
name
,
'app.apk'
);
},
overrides:
overrides
);
testUsingContext
(
'Licenses available, build tools not, apk exists'
,
()
async
{
when
(
sdk
.
latestVersion
).
thenReturn
(
null
);
final
FlutterProject
project
=
await
FlutterProject
.
current
();
...
...
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