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
04d542b1
Commit
04d542b1
authored
Dec 31, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1045 from devoncarew/min_api_level
update the min api level in the generated android manifest
parents
29ab6efd
fc0b18c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
init.dart
packages/flutter_tools/lib/src/commands/init.dart
+8
-3
device.dart
packages/flutter_tools/lib/src/device.dart
+15
-12
No files found.
packages/flutter_tools/lib/src/commands/init.dart
View file @
04d542b1
...
@@ -12,6 +12,7 @@ import 'package:path/path.dart' as path;
...
@@ -12,6 +12,7 @@ import 'package:path/path.dart' as path;
import
'../artifacts.dart'
;
import
'../artifacts.dart'
;
import
'../base/logging.dart'
;
import
'../base/logging.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../device.dart'
;
class
InitCommand
extends
Command
{
class
InitCommand
extends
Command
{
final
String
name
=
'init'
;
final
String
name
=
'init'
;
...
@@ -121,7 +122,11 @@ abstract class Template {
...
@@ -121,7 +122,11 @@ abstract class Template {
String
relativeFlutterPackagePath
=
path
.
relative
(
flutterPackagePath
,
from:
dirPath
);
String
relativeFlutterPackagePath
=
path
.
relative
(
flutterPackagePath
,
from:
dirPath
);
files
.
forEach
((
String
filePath
,
String
contents
)
{
files
.
forEach
((
String
filePath
,
String
contents
)
{
Map
m
=
{
'projectName'
:
projectName
,
'description'
:
description
,
'flutterPackagePath'
:
relativeFlutterPackagePath
};
Map
m
=
{
'projectName'
:
projectName
,
'description'
:
description
,
'flutterPackagePath'
:
relativeFlutterPackagePath
};
contents
=
mustache
.
render
(
contents
,
m
);
contents
=
mustache
.
render
(
contents
,
m
);
filePath
=
filePath
.
replaceAll
(
'/'
,
Platform
.
pathSeparator
);
filePath
=
filePath
.
replaceAll
(
'/'
,
Platform
.
pathSeparator
);
File
file
=
new
File
(
path
.
join
(
dir
.
path
,
filePath
));
File
file
=
new
File
(
path
.
join
(
dir
.
path
,
filePath
));
...
@@ -223,11 +228,11 @@ class FlutterDemo extends StatelessComponent {
...
@@ -223,11 +228,11 @@ class FlutterDemo extends StatelessComponent {
}
}
'''
;
'''
;
const
String
_apkManifest
=
r
''
'
final
String
_apkManifest
=
'''
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.{{projectName}}">
package="com.example.{{projectName}}">
<uses-sdk android:minSdkVersion="
14
" android:targetSdkVersion="21" />
<uses-sdk android:minSdkVersion="
${AndroidDevice.minApiLevel}
" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:name="org.domokit.sky.shell.SkyApplication" android:label="{{projectName}}">
<application android:name="org.domokit.sky.shell.SkyApplication" android:label="{{projectName}}">
...
...
packages/flutter_tools/lib/src/device.dart
View file @
04d542b1
...
@@ -474,7 +474,11 @@ class IOSSimulator extends Device {
...
@@ -474,7 +474,11 @@ class IOSSimulator extends Device {
}
}
class
AndroidDevice
extends
Device
{
class
AndroidDevice
extends
Device
{
static
const
String
_ADB_PATH
=
'adb'
;
static
const
int
minApiLevel
=
16
;
static
const
String
minVersionName
=
'Jelly Bean'
;
static
const
String
minVersionText
=
'4.1.x'
;
static
const
String
_defaultAdbPath
=
'adb'
;
static
const
int
_observatoryPort
=
8181
;
static
const
int
_observatoryPort
=
8181
;
static
final
String
defaultDeviceID
=
'default_android_device'
;
static
final
String
defaultDeviceID
=
'default_android_device'
;
...
@@ -574,7 +578,7 @@ class AndroidDevice extends Device {
...
@@ -574,7 +578,7 @@ class AndroidDevice extends Device {
_adbPath
=
_getAdbPath
();
_adbPath
=
_getAdbPath
();
_hasAdb
=
_checkForAdb
();
_hasAdb
=
_checkForAdb
();
// Checking for
Jelly Bean
only needs to be done if we are starting an
// Checking for
[minApiName]
only needs to be done if we are starting an
// app, but it has an important side effect, which is to discard any
// app, but it has an important side effect, which is to discard any
// progress messages if the adb server is restarted.
// progress messages if the adb server is restarted.
_hasValidAndroid
=
_checkForSupportedAndroidVersion
();
_hasValidAndroid
=
_checkForSupportedAndroidVersion
();
...
@@ -606,8 +610,7 @@ class AndroidDevice extends Device {
...
@@ -606,8 +610,7 @@ class AndroidDevice extends Device {
static
String
_getAdbPath
()
{
static
String
_getAdbPath
()
{
if
(
Platform
.
environment
.
containsKey
(
'ANDROID_HOME'
))
{
if
(
Platform
.
environment
.
containsKey
(
'ANDROID_HOME'
))
{
String
androidHomeDir
=
Platform
.
environment
[
'ANDROID_HOME'
];
String
androidHomeDir
=
Platform
.
environment
[
'ANDROID_HOME'
];
String
adbPath1
=
String
adbPath1
=
path
.
join
(
androidHomeDir
,
'sdk'
,
'platform-tools'
,
'adb'
);
path
.
join
(
androidHomeDir
,
'sdk'
,
'platform-tools'
,
'adb'
);
String
adbPath2
=
path
.
join
(
androidHomeDir
,
'platform-tools'
,
'adb'
);
String
adbPath2
=
path
.
join
(
androidHomeDir
,
'platform-tools'
,
'adb'
);
if
(
FileSystemEntity
.
isFileSync
(
adbPath1
))
{
if
(
FileSystemEntity
.
isFileSync
(
adbPath1
))
{
return
adbPath1
;
return
adbPath1
;
...
@@ -615,11 +618,11 @@ class AndroidDevice extends Device {
...
@@ -615,11 +618,11 @@ class AndroidDevice extends Device {
return
adbPath2
;
return
adbPath2
;
}
else
{
}
else
{
logging
.
info
(
'"adb" not found at
\n
"
$adbPath1
" or
\n
"
$adbPath2
"
\n
'
+
logging
.
info
(
'"adb" not found at
\n
"
$adbPath1
" or
\n
"
$adbPath2
"
\n
'
+
'using default path "
$_
ADB_PATH
"'
);
'using default path "
$_
defaultAdbPath
"'
);
return
_
ADB_PATH
;
return
_
defaultAdbPath
;
}
}
}
else
{
}
else
{
return
_
ADB_PATH
;
return
_
defaultAdbPath
;
}
}
}
}
...
@@ -703,9 +706,10 @@ class AndroidDevice extends Device {
...
@@ -703,9 +706,10 @@ class AndroidDevice extends Device {
logging
.
severe
(
'Unexpected response from getprop: "
$sdkVersion
"'
);
logging
.
severe
(
'Unexpected response from getprop: "
$sdkVersion
"'
);
return
false
;
return
false
;
}
}
if
(
sdkVersionParsed
<
16
)
{
if
(
sdkVersionParsed
<
minApiLevel
)
{
logging
.
severe
(
'The Android version (
$sdkVersion
) on the target device '
logging
.
severe
(
'is too old. Please use a Jelly Bean (version 16 / 4.1.x) device or later.'
);
'The Android version (
$sdkVersion
) on the target device is too old. Please '
'use a
$minVersionName
(version
$minApiLevel
/
$minVersionText
) device or later.'
);
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
@@ -735,8 +739,7 @@ class AndroidDevice extends Device {
...
@@ -735,8 +739,7 @@ class AndroidDevice extends Device {
if
(!
isConnected
())
{
if
(!
isConnected
())
{
return
false
;
return
false
;
}
}
if
(
runCheckedSync
(
adbCommandForDevice
([
'shell'
,
'pm'
,
'path'
,
app
.
id
]))
==
if
(
runCheckedSync
(
adbCommandForDevice
([
'shell'
,
'pm'
,
'path'
,
app
.
id
]))
==
''
)
{
''
)
{
logging
.
info
(
logging
.
info
(
'TODO(iansf): move this log to the caller.
${app.name}
is not on the device. Installing now...'
);
'TODO(iansf): move this log to the caller.
${app.name}
is not on the device. Installing now...'
);
return
false
;
return
false
;
...
...
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