Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android Studio support] Gradle build issue after creating. #120

Closed
iamchathu opened this issue Sep 12, 2019 · 9 comments · Fixed by #194
Closed

[Android Studio support] Gradle build issue after creating. #120

iamchathu opened this issue Sep 12, 2019 · 9 comments · Fixed by #194
Labels
bug Something isn't working enhancement New feature or request

Comments

@iamchathu
Copy link

After creating new native android module, I opened android folder using Android Studio. It added missing gradle files and started the sync process and below error occurs.

INFO: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.

After editing android/build.gradle to below it get fixed.

  android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider) {
            from variant.javaCompileProvider.get().destinationDir
        }
    }
@brodycj brodycj added info-needed help wanted Extra attention is needed labels Sep 13, 2019
@brodycj
Copy link
Owner

brodycj commented Sep 13, 2019

Does this mean that you tried to open a generated module with Android Studio?

@iamchathu
Copy link
Author

@brodybits yes. I created Android only native module and open android folder from Android Studio and it added a gradle scripts and started to sync.

@brodycj brodycj added the enhancement New feature or request label Sep 13, 2019
@brodycj
Copy link
Owner

brodycj commented Sep 13, 2019

Thanks. Marked as an enhancement as I am not yet motivated to support this case.

@brodycj brodycj changed the title Gradle build issue after creating. [Android Studio support] Gradle build issue after creating. Sep 16, 2019
@brodycj
Copy link
Owner

brodycj commented Sep 16, 2019

The recommended approach is to generate the module with the example, then open the example project with Android Studio. You would likely have to copy artifacts between example/node_modules and android source tree if you develop in this manner.

Using Yarn workspaces (#128) may help us out.

Priority feature development with high-priority private support is available for commercial users, please contact sales@xpbrew.consulting for more details.

@brodycj
Copy link
Owner

brodycj commented Sep 19, 2019

This may be resolved by PR #135 in the 0.11.0 release.

@iamchathu
Copy link
Author

@brodybits Any plans to make old version build projects to upgrade to new versions?

@brodycj brodycj added info-needed and removed help wanted Extra attention is needed labels Sep 20, 2019
@brodycj
Copy link
Owner

brodycj commented Sep 20, 2019

Any plans to make old version build projects to upgrade to new versions?

See #19, with workaround upgrade procedure now documented. I would appreciate if you would report whether or not this build issue is resolved by the upgrade.

I hope to make the upgrade more automatic, no promise of timeline. Priority is given to commercial customers, please contact sales@xpbrew.consulting for more information.

@chetstone
Copy link

This is unrelated to Android Studio.
I see the same warning as @iamchathu and I don't use Android Studio.
I upgraded my module to RN 0.61 by creating a new module with this tool, then merging with the previous code. When I use my module in an app and compile with
-Pandroid.debug.obsoleteApi=true I get this warning:

> Configure project :react-native-palette
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
REASON: Called from: /Users/maint/prj/malas/upgrade/node_modules/react-native-palette/android/build.gradle:121
WARNING: Debugging obsolete API calls can take time during configuration. It's recommended to not keep it on at all times.

The offending line 121 is here. It is an exact copy of the line from the new library created with create-react-native-module

@brodycj
Copy link
Owner

brodycj commented Dec 2, 2019

Should be fixed now, I just merged PR #194 and published a new release.

In case of any further issues I would really appreciate a new issue with the standard minimal, reproducible example ([1]).

[1] https://stackoverflow.com/help/minimal-reproducible-example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants