我有一台运行Android 4.4.2的HTC Desire 510。
今年早些时候,当react-native init
仍然在项目根文件夹中生成index.android.js
和index.ios.js
时,我能够将反应原生应用部署到它上面。
今天,似乎react-native init
只在项目文件夹中生成一个index.js
文件(如本release not here中所述)。所以现在当我运行命令react-native run-android
将我的应用程序部署到我的手机时,我收到错误消息:
在任何根目录中找不到条目文件index.android.js: [" C:\用户\约翰\项目\ ReactNative \ htcandroidapp"]
如何将反应原生应用程序部署到我的旧HTC Desire 510手机?我将反应原生应用程序部署到我的新手机上没有问题。
这是我的android / app / build.gradle文件
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.nutriag"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':realm')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}