vicke4 / react-native-invoke-app

Bring React Native App to foreground from Headless JS
MIT License
58 stars 50 forks source link

Load Android Gradle Plugin conditionally #9

Closed SaeedZhiany closed 3 years ago

SaeedZhiany commented 4 years ago

Also, reading gradle common settings from the root project.

This wraps the Android Gradle plugin dependency in the buildscripts section of android/build.gradle in a conditional:

if (project == rootProject) {
    // ... (dependency here)
}

The Android Gradle plugin is only required when opening the project stand-alone, not when it is included as a dependency. By doing this, the project opens correctly in Android Studio, and it can also be consumed as a native module dependency from an application project without affecting the app project (avoiding unnecessary downloads/conflicts/etc).

for more info, you can refer to this thread and especially this comment.

Kraudia commented 3 years ago

Thanks, your changes helped me to build the release version. I had this error:

> Task :react-native-invoke-app:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

Execution failed for task ':react-native-invoke-app:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/XXX/.gradle/caches/transforms-2/files-2.1/37631cd0ab1b46aeb23414622984ad25/appcompat-1.0.2/res/values-v26/values-v26.xml:5:5-8:13: AAPT: error: resource android:attr/colorError not found.

     /Users/XXX/.gradle/caches/transforms-2/files-2.1/37631cd0ab1b46aeb23414622984ad25/appcompat-1.0.2/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

     /Users/XXX/.gradle/caches/transforms-2/files-2.1/37631cd0ab1b46aeb23414622984ad25/appcompat-1.0.2/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
SaeedZhiany commented 3 years ago

@Kraudia

I'm glad it could help you :)

and hope @vicke4 review and merge this branch to master!

vicke4 commented 3 years ago

Thanks for the PR @SaeedZhiany

SaeedZhiany commented 3 years ago

@Kraudia

you can now use this repository again. I want to remove my forked repository If you don't need it anymore. I'll postpone it until you give me feedback.

vicke4 commented 3 years ago

I have updated the package on npm also. @SaeedZhiany I'm looking for contributors for this project as I'm not working on react-native or android anymore. Can I add you?

SaeedZhiany commented 3 years ago

Thanks for the offer @vicke4, I'll be glad if I can be useful but I'm busy too with my job. I'm not sure whether I can maintain the project actively.

vicke4 commented 3 years ago

Thanks for the reply @SaeedZhiany. I can understand.