我尝试在我的 android 设备上运行 ionic 应用程序并且出现错误
Posted
技术标签:
【中文标题】我尝试在我的 android 设备上运行 ionic 应用程序并且出现错误【英文标题】:I try to running ionic app on my android device and there are errors 【发布时间】:2020-03-04 09:56:51 【问题描述】:我得到的错误:
20:29 Gradle sync failed: Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
Required by:
unspecified:unspecified:unspecified > com.android.tools.build:gradl... (show balloon)
20:29 NDK Resolution Outcome: Project settings: Gradle model version=4.6, NDK version is UNKNOWN
我安装 NDK
local.properties 文件:
sdk.dir=C:\Users\Chen Fridman\AppData\Local\Android\Sdk
ndk.dir=C:\Users\Chen Fridman\AppData\Local\Android\Sdk\ndk\20.1.5948944
build.gradle (project:android) 文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
repositories
mavenCentral()
google()
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
allprojects
repositories
google()
jcenter()
task clean(type: Delete)
delete rootProject.buildDir
.......................................
build.gradle(应用)文件:
apply plugin: 'com.android.application'
android
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig
applicationId "io.ionic.simhatzkenti"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
exclude group: 'com.android.support', module: 'support-annotations'
)
compile 'com.android.support:appcompat-v7:29.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
apply plugin: 'com.google.gms.google-services'
#Tue Jan 30 13:14:22 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
我真的需要帮助,我被困住了! 非常感谢!
【问题讨论】:
能否请您同时填写build.gradle
app 和build.gradle
项目文件?
嗨,我更新了我的问题,谢谢
【参考方案1】:
您是否按照 ionic 应用程序的 android 安装说明进行操作?通常您不需要 NDK。
https://ionicframework.com/docs
https://ionicframework.com/docs/building/android
【讨论】:
【参考方案2】:这是你的固定文件。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
ext.kotlin_version = '1.3.50'
repositories
mavenCentral()
google()
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
allprojects
repositories
google()
jcenter()
task clean(type: Delete)
delete rootProject.buildDir
apply plugin: 'com.android.application'
android
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig
applicationId "io.ionic.simhatzkenti"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
exclude group: 'com.android.support', module: 'support-annotations'
)
implementation 'com.android.support:appcompat-v7:29.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation 'junit:junit:4.12'
apply plugin: 'com.google.gms.google-services'
#Tue Jan 30 13:14:22 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
【讨论】:
这一切的解决办法在哪里?以上是关于我尝试在我的 android 设备上运行 ionic 应用程序并且出现错误的主要内容,如果未能解决你的问题,请参考以下文章
当我尝试在我的 Android 设备上预览我的应用程序时显示错误
我正在尝试在我的设备上获得真实的广告,但应用在我的 Android 应用上显示测试广告
我的 Android 应用程序在模拟器上运行,但无法在我的 android 设备上运行