Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Release build failed #81

Open
MBach opened this issue Apr 9, 2019 · 9 comments
Open

Release build failed #81

MBach opened this issue Apr 9, 2019 · 9 comments

Comments

@MBach
Copy link

MBach commented Apr 9, 2019

Hi,

Using "react-native-quick-actions": "0.3.10" I can't build my App any more!

* What went wrong:
Execution failed for task ':react-native-quick-actions:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2711: error: resource android:attr/fontStyle not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2712: error: resource android:attr/font not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2713: error: resource android:attr/fontWeight not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2714: error: resource android:attr/fontVariationSettings not found.
  C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2715: error: resource android:attr/ttcIndex not found.
  error: failed linking references.


* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-quick-actions:verifyReleaseResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
        at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2711: error: resource android:attr/fontStyle not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2712: error: resource android:attr/font not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2713: error: resource android:attr/fontWeight not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2714: error: resource android:attr/fontVariationSettings not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2715: error: resource android:attr/ttcIndex not found.
error: failed linking references.

        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
        ... 31 more
Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2711: error: resource android:attr/fontStyle not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2712: error: resource android:attr/font not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2713: error: resource android:attr/fontWeight not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2714: error: resource android:attr/fontVariationSettings not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2715: error: resource android:attr/ttcIndex not found.
error: failed linking references.

        at com.android.ide.common.workers.ExecutorServiceAdapter.close(ExecutorServiceAdapter.kt:56)
        at kotlin.io.CloseableKt.closeFinally(Closeable.kt:53)
        at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.compileAndVerifyResources(VerifyLibraryResourcesTask.kt:130)
        at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.doFullTaskAction(VerifyLibraryResourcesTask.kt:110)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        ... 42 more
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2711: error: resource android:attr/fontStyle not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2712: error: resource android:attr/font not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2713: error: resource android:attr/fontWeight not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2714: error: resource android:attr/fontVariationSettings not found.
C:\dev\rn-breastfeeding\node_modules\react-native-quick-actions\android\build\intermediates\res\merged\release\values\values.xml:2715: error: resource android:attr/ttcIndex not found.
error: failed linking references.

        at com.android.builder.internal.aapt.v2.Aapt2Exception$Companion.create(Aapt2Exception.kt:45)
        at com.android.builder.internal.aapt.v2.Aapt2Exception$Companion.create$default(Aapt2Exception.kt:39)
        at com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.doLink(Aapt2DaemonImpl.kt:188)
        at com.android.builder.internal.aapt.v2.Aapt2Daemon.link(Aapt2Daemon.kt:103)
        at com.android.builder.internal.aapt.v2.Aapt2DaemonManager$LeasedAaptDaemon.link(Aapt2DaemonManager.kt:176)
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:839)
        at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable$run$1.invoke(Aapt2ProcessResourcesRunnable.kt:34)
        at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable$run$1.invoke(Aapt2ProcessResourcesRunnable.kt:28)
        at com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon(Aapt2DaemonManagerService.kt:71)
        at com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon$default(Aapt2DaemonManagerService.kt:69)
        at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable.run(Aapt2ProcessResourcesRunnable.kt:33)
        at com.android.ide.common.workers.ExecutorServiceAdapter$submit$submission$1.run(ExecutorServiceAdapter.kt:39)
        ... 48 more


* Get more help at https://help.gradle.org

BUILD FAILED in 54s
183 actionable tasks: 3 executed, 180 up-to-date
@jordanbyron
Copy link
Owner

Have you tried an earlier release? There was a recent change to the Android build you might be hitting up against.

@MBach
Copy link
Author

MBach commented Apr 10, 2019

Release 0.3.9 was working fine.

I have made a complete clean but it didn't work as excepted (removed node_modules, Android build folders, etc.)

@jordanbyron
Copy link
Owner

If 0.3.9 is working then I'd suggest you take a look at the release notes for 0.3.10 and the PR which introduced the change to 0.3.10 #80. As I've said in the past my android knowledge is fairly sparse. It's possible #80 introduced a breaking change and I should have bumped the version to 0.4, but that wasn't immediately obvious to me. Anyway take a look at #80 and see if upgrading your react build tools helps.

@jordanbyron
Copy link
Owner

@MBach ping. Any luck figuring out what was happening here?

@MBach
Copy link
Author

MBach commented Apr 17, 2019

I think something like this should do the trick:

apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
    compileSdkVersion safeExtGet('compileSdkVersion', 25)
    buildToolsVersion safeExtGet('buildToolsVersion', "25.0.2") 

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 21)
        targetSdkVersion safeExtGet('targetSdkVersion', 25)
    }
}

dependencies {
    implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}

With this, the release build was OK!

@jordanbyron
Copy link
Owner

@MBach thanks for the update. We've been down this road before in #73, but the efforts stalled when I asked for some protections in the safeExtGet method to ensure the project's current compileSdkVersion and minSdkVersion don't drop below the required version for the project. Mostly to save the consumers of this library from trying to use this in a project that doesn't support application shortcuts. This might be a misapplied place to enforce that check. I'm not sure how dependencies are resolved in the Android build process.

@MBach
Copy link
Author

MBach commented Apr 19, 2019

So it's not really a problem IMO. Fix the minSdkVersion to 21 and you're good to go! Right now, I don't think anyone is using a compileSdkVersion lower than 25.

@jordanbyron
Copy link
Owner

Is this something you’d be willing to cook up? Or do you think #73 is close to what you’d do and I should just resurrect that and merge it in? Leaning pretty heavily on your experience here as again I’m feeling around in the dark.

@MBach
Copy link
Author

MBach commented Apr 19, 2019

If I remember correctly, dynamic shortcuts are working only with SDK 25 (Android 7.1), so it's kind of strange to have a minSdkVersion at 21. There is no reason to upgrade the lower bound to 21 instead of 16.

Also, you are using @TargetApi which is an old way to do it.
I think the Android implementation could be refactored by using @RequireApi and wrapping the bridge with a classic if statement, and deporting the code into a private function:

@ReactMethod
public void setShortcutItems(ReadableArray items) {
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        setDynamicShortcuts(args);
    }
}

and

@RequiresApi(Build.VERSION_CODES.N_MR1)
private void setDynamicShortcuts(args) {
   ///
}

The idea behind this is to be able to compile and execute the code everywhere, even on very old devices, but it won't do anything.

Finally, yes, PR#73 is close to what I've done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants