我正在努力为Apache Cordova设置开发环境。我想针对运行Fire OS 5.3.6.4(626532920)的Amazon Fire HD 7。
Wikipedia告诉我:
这些发布是根据其Android代码库的基础版本按时间顺序进行分类的。
所以我假设这是基于Android 5.1.1 Lollipop构建的吗?
我首先使用
安装了Cordovaapply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.project.bluetoothdataexchange"
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled = true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
implementation 'com.github.bumptech.glide:glide:3.7.0'
//implementation 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.firebase:firebase-storage:15.0.0'
implementation 'com.firebase:firebase-client-android:2.4.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
implementation project(':facebookSDK')
implementation 'org.twitter4j:twitter4j-core:4.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.firebase:geofire-android:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
然后我使用生成了一个新项目
yarn global add cordova
我使用添加了Android作为预期的平台
cordova create hello_world com.mycompany.hello_world HelloWorld
(安装了cordova-android@~7.1.1)
运行cordova platform add android
后,我收到以下信息:
cordova requirements
我解决了(大多数)这些问题,如下所示:
我使用酿造桶安装了Java 8(因为Java的更高版本似乎不兼容)
Requirements check results for android:
Java JDK: not installed
Failed to find 'JAVA_HOME' environment variable. Try setting it manually.
Android SDK: not installed
Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
Android target: not installed
android: Command failed with exit code ENOENT
Gradle: not installed
Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.
Might need to install Android SDK or set up 'ANDROID_HOME' env variable.
Some of requirements check failed
您首先需要创建一个空的存储库配置,否则后面的步骤将失败
brew tap caskroom/versions
brew cask install java8
然后,就touch ~/.android/repositories.cfg
而言,这使情况看起来更加健康:
cordova requirements
但是,我正在为如何为此设备设置Android目标而苦苦挣扎。
我想我需要运行类似的东西
Android Studio project detected
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
No android targets (SDKs) installed!
Gradle: installed /usr/local/Cellar/gradle/4.10.2/bin/gradle
Some of requirements check failed
但是我不确定应该使用哪个版本的Android。有一个handy table on the Cordova site,但对我来说并没有太大的意义...