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
b38a6cbb
Commit
b38a6cbb
authored
Feb 15, 2017
by
Michael Goderbauer
Committed by
GitHub
Feb 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace jarsigner with apksigner (#8154)
parent
15af4a04
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
41 deletions
+33
-41
README.md
dev/bots/README.md
+1
-1
VERSION_LINUX_SDK
dev/bots/VERSION_LINUX_SDK
+1
-1
VERSION_MACOSX_SDK
dev/bots/VERSION_MACOSX_SDK
+1
-1
VERSION_WIN_SDK
dev/bots/VERSION_WIN_SDK
+1
-1
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+6
-0
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+9
-17
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+14
-20
No files found.
dev/bots/README.md
View file @
b38a6cbb
...
@@ -102,7 +102,7 @@ Instructions to update the Android Tools version that the bots download by execu
...
@@ -102,7 +102,7 @@ Instructions to update the Android Tools version that the bots download by execu
The following packages are currently installed:
The following packages are currently installed:
*
Android SDK Tools
*
Android SDK Tools
*
Android SDK platform-tools
*
Android SDK platform-tools
*
Android SDK Build-tools 2
3.0.1
*
Android SDK Build-tools 2
4.0.3
*
Android 6.0 (API 23)
*
Android 6.0 (API 23)
*
SDK Platform 23
*
SDK Platform 23
*
Extras
*
Extras
...
...
dev/bots/VERSION_LINUX_SDK
View file @
b38a6cbb
0d320c50b0ed188c7e1182388e2beb623a1d307d
efeebca78800d6855e15a22c6087a54766d1d4e9
dev/bots/VERSION_MACOSX_SDK
View file @
b38a6cbb
fa5ea0ca1e0c7c2e40914f3202c7545de4dbca9c
7eb88931c39c05a3b140da769e67c216d45db2b9
dev/bots/VERSION_WIN_SDK
View file @
b38a6cbb
e5715e2cc0d5644a241a4b3281bfada92bc145c2
4b0d8fa0dcacd537330149332a28e033edfd3ca8
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
b38a6cbb
...
@@ -24,6 +24,7 @@ const String kAndroidHome = 'ANDROID_HOME';
...
@@ -24,6 +24,7 @@ const String kAndroidHome = 'ANDROID_HOME';
// $ANDROID_HOME/build-tools/22.0.1/aapt
// $ANDROID_HOME/build-tools/22.0.1/aapt
// $ANDROID_HOME/build-tools/23.0.2/aapt
// $ANDROID_HOME/build-tools/23.0.2/aapt
// $ANDROID_HOME/build-tools/24.0.0-preview/aapt
// $ANDROID_HOME/build-tools/24.0.0-preview/aapt
// $ANDROID_HOME/build-tools/25.0.2/apksigner
// $ANDROID_HOME/platforms/android-22/android.jar
// $ANDROID_HOME/platforms/android-22/android.jar
// $ANDROID_HOME/platforms/android-23/android.jar
// $ANDROID_HOME/platforms/android-23/android.jar
...
@@ -225,6 +226,8 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
...
@@ -225,6 +226,8 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
String
get
zipalignPath
=>
getBuildToolsPath
(
'zipalign'
);
String
get
zipalignPath
=>
getBuildToolsPath
(
'zipalign'
);
String
get
apksignerPath
=>
getBuildToolsPath
(
'apksigner'
);
List
<
String
>
validateSdkWellFormed
()
{
List
<
String
>
validateSdkWellFormed
()
{
if
(
_exists
(
androidJarPath
)
!=
null
)
if
(
_exists
(
androidJarPath
)
!=
null
)
return
<
String
>[
_exists
(
androidJarPath
)];
return
<
String
>[
_exists
(
androidJarPath
)];
...
@@ -238,6 +241,9 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
...
@@ -238,6 +241,9 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
if
(
_canRun
(
zipalignPath
)
!=
null
)
if
(
_canRun
(
zipalignPath
)
!=
null
)
return
<
String
>[
_canRun
(
zipalignPath
)];
return
<
String
>[
_canRun
(
zipalignPath
)];
if
(
_canRun
(
apksignerPath
)
!=
null
)
return
<
String
>[
_canRun
(
apksignerPath
)
+
'
\n
apksigner requires Android SDK Build Tools 24.0.3 or newer.'
];
return
<
String
>[];
return
<
String
>[];
}
}
...
...
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
b38a6cbb
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'../base/io.dart'
;
import
'../base/io.dart'
;
import
'../base/os.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process_manager.dart'
;
import
'../base/process_manager.dart'
;
import
'../doctor.dart'
;
import
'../doctor.dart'
;
...
@@ -63,11 +62,11 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
...
@@ -63,11 +62,11 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
}
}
List
<
String
>
validationResult
=
androidSdk
.
validateSdkWellFormed
();
List
<
String
>
validationResult
=
androidSdk
.
validateSdkWellFormed
();
// Empty result means SDK is well formated.
if
(
validationResult
.
isEmpty
)
{
if
(
validationResult
.
isEmpty
)
{
// Empty result means SDK is well formatted.
// The SDK also requires a valid Java JDK installation.
const
String
_kJdkDownload
=
'https://www.oracle.com/technetwork/java/javase/downloads/'
;
const
String
_kJdkDownload
=
'https://www.oracle.com/technetwork/java/javase/downloads/'
;
String
javaVersion
;
String
javaVersion
;
try
{
try
{
...
@@ -82,27 +81,20 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
...
@@ -82,27 +81,20 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
if
(
javaVersion
!=
null
)
{
if
(
javaVersion
==
null
)
{
messages
.
add
(
new
ValidationMessage
(
javaVersion
));
if
(
os
.
which
(
'jarsigner'
)
==
null
)
{
messages
.
add
(
new
ValidationMessage
.
error
(
'The jarsigner utility was not found; this is used to build Android APKs. You may need to install
\n
'
'or re-install the Java JDK:
$_kJdkDownload
.'
));
}
else
{
type
=
ValidationType
.
installed
;
}
}
else
{
messages
.
add
(
new
ValidationMessage
.
error
(
messages
.
add
(
new
ValidationMessage
.
error
(
'No Java Development Kit (JDK) found; you can download the JDK from
$_kJdkDownload
.'
'No Java Development Kit (JDK) found; you can download the JDK from
$_kJdkDownload
.'
));
));
}
else
{
type
=
ValidationType
.
installed
;
}
}
}
else
{
}
else
{
messages
.
addAll
(
validationResult
.
map
((
String
message
)
{
messages
.
addAll
(
validationResult
.
map
((
String
message
)
{
return
new
ValidationMessage
.
error
(
message
);
return
new
ValidationMessage
.
error
(
message
);
}));
}));
messages
.
add
(
new
ValidationMessage
(
'Try re-installing or updating your Android SDK.'
));
messages
.
add
(
new
ValidationMessage
(
'Try re-installing or updating your Android SDK,
\n
'
'visit https://flutter.io/setup/#android-setup for detailed instructions.'
));
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
b38a6cbb
...
@@ -10,7 +10,6 @@ import '../android/gradle.dart';
...
@@ -10,7 +10,6 @@ import '../android/gradle.dart';
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
import
'../base/os.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../base/process_manager.dart'
;
import
'../base/process_manager.dart'
;
import
'../base/utils.dart'
;
import
'../base/utils.dart'
;
...
@@ -68,14 +67,14 @@ class _ApkBuilder {
...
@@ -68,14 +67,14 @@ class _ApkBuilder {
File
_aapt
;
File
_aapt
;
File
_dx
;
File
_dx
;
File
_zipalign
;
File
_zipalign
;
File
_
jar
signer
;
File
_
apk
signer
;
_ApkBuilder
(
this
.
sdk
)
{
_ApkBuilder
(
this
.
sdk
)
{
_androidJar
=
fs
.
file
(
sdk
.
androidJarPath
);
_androidJar
=
fs
.
file
(
sdk
.
androidJarPath
);
_aapt
=
fs
.
file
(
sdk
.
aaptPath
);
_aapt
=
fs
.
file
(
sdk
.
aaptPath
);
_dx
=
fs
.
file
(
sdk
.
dxPath
);
_dx
=
fs
.
file
(
sdk
.
dxPath
);
_zipalign
=
fs
.
file
(
sdk
.
zipalignPath
);
_zipalign
=
fs
.
file
(
sdk
.
zipalignPath
);
_
jarsigner
=
os
.
which
(
'jarsigner'
);
_
apksigner
=
fs
.
file
(
sdk
.
apksignerPath
);
}
}
String
checkDependencies
()
{
String
checkDependencies
()
{
...
@@ -87,10 +86,8 @@ class _ApkBuilder {
...
@@ -87,10 +86,8 @@ class _ApkBuilder {
return
'Cannot find dx at
${_dx.path}
'
;
return
'Cannot find dx at
${_dx.path}
'
;
if
(!
processManager
.
canRun
(
_zipalign
.
path
))
if
(!
processManager
.
canRun
(
_zipalign
.
path
))
return
'Cannot find zipalign at
${_zipalign.path}
'
;
return
'Cannot find zipalign at
${_zipalign.path}
'
;
if
(
_jarsigner
==
null
)
if
(!
processManager
.
canRun
(
_apksigner
.
path
))
return
'Cannot find jarsigner in PATH.'
;
return
'Cannot find apksigner at
${_apksigner.path}
'
;
if
(!
_jarsigner
.
existsSync
())
return
'Cannot find jarsigner at
${_jarsigner.path}
'
;
return
null
;
return
null
;
}
}
...
@@ -123,15 +120,13 @@ class _ApkBuilder {
...
@@ -123,15 +120,13 @@ class _ApkBuilder {
}
}
void
sign
(
File
keystore
,
String
keystorePassword
,
String
keyAlias
,
String
keyPassword
,
File
outputApk
)
{
void
sign
(
File
keystore
,
String
keystorePassword
,
String
keyAlias
,
String
keyPassword
,
File
outputApk
)
{
assert
(
_jarsigner
!=
null
);
assert
(
_apksigner
!=
null
);
runCheckedSync
(<
String
>[
_jarsigner
.
path
,
runCheckedSync
(<
String
>[
_apksigner
.
path
,
'sign'
,
'-keystore'
,
keystore
.
path
,
'--ks'
,
keystore
.
path
,
'-storepass'
,
keystorePassword
,
'--ks-key-alias'
,
keyAlias
,
'-keypass'
,
keyPassword
,
'--ks-pass'
,
'pass:
$keystorePassword
'
,
'-digestalg'
,
'SHA1'
,
'--key-pass'
,
'pass:
$keyPassword
'
,
'-sigalg'
,
'MD5withRSA'
,
outputApk
.
path
,
outputApk
.
path
,
keyAlias
,
]);
]);
}
}
...
@@ -371,15 +366,14 @@ int _buildApk(
...
@@ -371,15 +366,14 @@ int _buildApk(
unalignedApk
,
components
.
manifest
,
assetBuilder
.
directory
,
unalignedApk
,
components
.
manifest
,
assetBuilder
.
directory
,
artifactBuilder
.
directory
,
components
.
resources
,
buildMode
artifactBuilder
.
directory
,
components
.
resources
,
buildMode
);
);
int
signResult
=
_signApk
(
builder
,
components
,
unalignedApk
,
keystore
,
buildMode
);
if
(
signResult
!=
0
)
return
signResult
;
File
finalApk
=
fs
.
file
(
outputFile
);
File
finalApk
=
fs
.
file
(
outputFile
);
ensureDirectoryExists
(
finalApk
.
path
);
ensureDirectoryExists
(
finalApk
.
path
);
builder
.
align
(
unalignedApk
,
finalApk
);
builder
.
align
(
unalignedApk
,
finalApk
);
int
signResult
=
_signApk
(
builder
,
components
,
finalApk
,
keystore
,
buildMode
);
if
(
signResult
!=
0
)
return
signResult
;
printTrace
(
'calculateSha:
$outputFile
'
);
printTrace
(
'calculateSha:
$outputFile
'
);
File
apkShaFile
=
fs
.
file
(
'
$outputFile
.sha1'
);
File
apkShaFile
=
fs
.
file
(
'
$outputFile
.sha1'
);
apkShaFile
.
writeAsStringSync
(
calculateSha
(
finalApk
));
apkShaFile
.
writeAsStringSync
(
calculateSha
(
finalApk
));
...
...
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