我尝试通过tns run android --log trace
运行我的NativeScript应用程序。在做了一些事情很长一段时间后,我得到以下错误:
%my_Path%\ platforms \ android \ src \ main \ AndroidManifest.xml:27:9-31错误: 属性meta-data#android.support.VERSION@value value =(25.3.1)来自[com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 也出现在[com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value =(26.0.0-alpha1)。 建议:添加'工具:replace =" android:value"'到AndroidManifest.xml:25:5-27:34的元素覆盖。
有关清单合并的详细信息,请参阅http://g.co/androidstudio/manifest-merger。
:processF0F1F2F3DebugManifest FAILED
失败:构建因异常而失败。
出了什么问题: 任务执行失败':processF0F1F2F3DebugManifest'。 清单合并失败:[com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31中的属性meta-data#android.support.VERSION@value value =(25.3.1) 也出现在[com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value =(26.0.0-alpha1)。 建议:添加'工具:replace =" android:value"'到AndroidManifest.xml:25:5-27:34的元素覆盖。
尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。
建立失败
总时间:1分钟5.249秒 无法在设备上应用更改:emulator-5554。错误是:命令gradlew.bat失败,退出代码为1。
我的设置:
npm -v
= 3.10.10
node -v
= v6.11.2
JAVA_HOME
环境变量已正确设置
ANDROID_HOME
设置为C:... \ AppData \ Local \ Android \ android-sdk
tns doctor
说:
┌──────────────────┬─────────────────┬────────────────┬──────────────────┐
│ Component │ Current version │ Latest version │ Information │
│ tns-core-modules │ 2.2.1 │ 3.1.1 │ Update available │
└──────────────────┴─────────────────┴────────────────┴──────────────────┘
tns devices
:
┌───┬────────────────┬──────────┬───────────────────┬──────────┬───────────┐
│ # │ Device Name │ Platform │ Device Identifier │ Type │ Status │
│ 1 │ sdk_gphone_x86 │ Android │ emulator-5554 │ Emulator │ Connected │
└───┴────────────────┴──────────┴───────────────────┴──────────┴───────────┘
在iOS上该项目正常运行。
---------------更新-----------------
将configurations.all
依赖项添加到我的app.gradle
文件后,我收到以下错误:
Exception in thread "main" java.lang.IllegalArgumentException: Class android.support.graphics.drawable.AnimatedVectorDrawableCompat$AnimatedVectorDrawableCompatState conflict: %my_path%\platforms\android\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\26.0.0-alpha1\jars\classes.jar and %my_path%\platforms\android\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\25.3.1\jars\classes.jar
at com.telerik.metadata.ClassRepo.addToCache(ClassRepo.java:21)
at com.telerik.metadata.Builder.build(Builder.java:38)
at com.telerik.metadata.Generator.main(Generator.java:44)
:buildMetadata FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildMetadata'.
Process 'command 'C:\Program Files\Java\jdk1.8.0_144\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
----------------------更新2 ----------------------- --------------
我导航到我的platforms/android
目录并运行gradlew clean
并再次尝试。它没有改变结果。我也尝试过其他模拟器。
现在我再次导航到platforms/android
并运行gradlew build -s
:
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
at org.gradle.api.tasks.compile.JavaCompile.setDependencyCacheDir(JavaCompile.java:241)
//...
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
at org.gradle.api.internal.tasks.DefaultTaskInputs.source(DefaultTaskInputs.java:136)
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at org.gradle.api.internal.AbstractTask.leftShift(AbstractTask.java:513)
//...
%my_path%\platforms\android\build\intermediates\res\merged\F0F1F2F3\debug\values-v24\values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
%my_path%\platforms\android\build\intermediates\res\merged\F0F1F2F3\debug\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
%my_path%\platforms\android\build\intermediates\res\merged\F0F1F2F3\debug\values-v24\values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
%my_path%\platforms\android\build\intermediates\res\merged\F0F1F2F3\debug\values-v24\values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
:processF0F1F2F3DebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processF0F1F2F3DebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':processF0F1F2F3DebugResources'.
//...
Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:185)
//...
Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:873)
//...
Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing 'C:\Users\frr\AppData\Local\Android\android-sdk\build-tools\25.0.2\aapt.exe' with arguments {package -f --no-crunch -I C:\Users\frr\AppData\Local\Android\android-sdk\platforms\android-23\android.jar -M C:\Dev\biff\HandyApp\platforms\android\build\intermediates\manifests\full\F0F1F2F3\debug\AndroidManifest.xml -S C:\Dev\biff\HandyApp\platforms\android\build\intermediates\res\merged\F0F1F2F3\debug -m -J C:\Dev\biff\HandyApp\platforms\android\build\generated\source\r\F0F1F2F3\debug -F C:\Dev\biff\HandyApp\platforms\android\build\intermediates\res\resources-F0-F1-F2-F3-debug.ap_ --debug-mode --custom-package de.filmfestbraunschweig.biff -0 apk --no-version-vectors --output-text-symbols C:\Dev\biff\HandyApp\platforms\android\build\intermediates\symbols\F0F1F2F3\debug --no-version-vectors}
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
//...
Caused by: com.android.ide.common.process.ProcessException: Error while executing 'C:\Users\frr\AppData\Local\Android\android-sdk\build-tools\25.0.2\aapt.exe' with arguments {package -f --no-crunch -I C:\Users\frr\AppData\Local\Android\android-sdk\platforms\android-23\android.jar -M C:\Dev\biff\HandyApp\platforms\android\build\intermediates\manifests\full\F0F1F2F3\debug\AndroidManifest.xml -S C:\Dev\biff\HandyApp\platforms\android\build\intermediates\res\merged\F0F1F2F3\debug -m -J C:\Dev\biff\HandyApp\platforms\android\build\generated\source\r\F0F1F2F3\debug -F C:\Dev\biff\HandyApp\platforms\android\build\intermediates\res\resources-F0-F1-F2-F3-debug.ap_ --debug-mode --custom-package de.filmfestbraunschweig.biff -0 apk --no-version-vectors --output-text-symbols C:\Dev\biff\HandyApp\platforms\android\build\intermediates\symbols\F0F1F2F3\debug --no-version-vectors}
at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:75)
//...
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\frr\AppData\Local\Android\android-sdk\build-tools\25.0.2\aapt.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:369)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:47)
... 9 more
BUILD FAILED
我的app.gradle:
// Add your native dependencies here:
// Uncomment to add recyclerview-v7 dependency
//dependencies {
// compile 'com.android.support:recyclerview-v7:+'
//}
android {
defaultConfig {
generatedDensities = []
applicationId = %applicationID%
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
dependencies {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
details.useVersion '26.0.+'
}
}
}
}
}
在我的package.json中,我定义了以下内容:
"nativescript": {
"id": %NativeScriptID%,
"tns-ios": {
"version": "3.1.0"
},
"tns-android": {
"version": "3.1.1"
}
}
NativeScriptID与app.gradle中的applicationID不同。
编辑:我在Windows 10上运行
答案 0 :(得分:1)
github用户DickSmith在https://github.com/NativeScript/NativeScript/issues/4677#issuecomment-321331910的回复 似乎与新的支持26库冲突有关。
dependencies {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
details.useVersion '26.0.+'
}
}
}
}
将其添加到您的app / App_Resources / Android / app.gradle中,或者将其与依赖项中的任何内容{...}合并,您应该很好。