Reputation: 943
I tried to run my NativeScript application via tns run android --log trace
. After doing some stuff for quite a long time I get the following error:
%my_Path%\platforms\android\src\main\AndroidManifest.xml:27:9-31 Error: Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:processF0F1F2F3DebugManifest FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':processF0F1F2F3DebugManifest'. Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 5.249 secs Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.
My setting:
npm -v
= 3.10.10
node -v
= v6.11.2
JAVA_HOME
environment variable is properly set
ANDROID_HOME
is set to C:...\AppData\Local\Android\android-sdk
tns doctor
says:
┌──────────────────┬─────────────────┬────────────────┬──────────────────┐
│ Component │ Current version │ Latest version │ Information │
│ tns-core-modules │ 2.2.1 │ 3.1.1 │ Update available │
└──────────────────┴─────────────────┴────────────────┴──────────────────┘
And tns devices
:
┌───┬────────────────┬──────────┬───────────────────┬──────────┬───────────┐
│ # │ Device Name │ Platform │ Device Identifier │ Type │ Status │
│ 1 │ sdk_gphone_x86 │ Android │ emulator-5554 │ Emulator │ Connected │
└───┴────────────────┴──────────┴───────────────────┴──────────┴───────────┘
On iOS that project works properly.
--------------- UPDATE -----------------
After adding the configurations.all
dependency to my app.gradle
file i get the following error:
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
---------------------- UPDATE 2 -------------------------------------
I navigated into my platforms/android
directory and ran gradlew clean
and tried again. It did not change the outcome. I also tried other emulators.
Now I navigated again into platforms/android
and ran 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
my 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.+'
}
}
}
}
}
In my package.json I define the following:
"nativescript": {
"id": %NativeScriptID%,
"tns-ios": {
"version": "3.1.0"
},
"tns-android": {
"version": "3.1.1"
}
}
The NativeScriptID is different from the applicationID in the app.gradle.
Edit: I am running on Windows 10
Upvotes: 2
Views: 10468
Reputation: 1486
The reply by github user DickSmith in https://github.com/NativeScript/NativeScript/issues/4677#issuecomment-321331910 seems to do the job with the new support 26 library conflicts.
dependencies {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
details.useVersion '26.0.+'
}
}
}
}
Add that to your app/App_Resources/Android/app.gradle or merge it with whatever you have in dependencies {...} already and you should be good.
Upvotes: 3