skip to Main Content

I have created a RN module. No error there, But i am not getting suggestions and compile time error detection auto complete , references and usage and all.

I have made the module with create-react-native-library

If I import entire project dir (which includes ios, android dir) then gradle is synced but no features works while coding.

If I only import android directory, it throws errors and sync fails.

Error:
gradleCould not create task ‘:generateDebugRFile’.
Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

Edit: I was able to fix above error. then it has error as
Failed to resolve: com.facebook.react:react-native+

I am looking for a proper way to write code for react native android (java, kotlin)

2

Answers


  1. Chosen as BEST ANSWER

    Solved and working like charm.

    • I upgraded the android studio to latest version.
    • I open the RN project (the actuall app project, not module project i was trying to develope)
    • Then I let android studio to sync

    now my RN module also synced nicley and all features are working fine.


  2. The error message you provided suggests that there is an issue with using the @TaskAction annotation on the taskAction$gradle_core() method of an IncrementalTask because the IncrementalTaskInputs interface is not a valid parameter for an action method.

    1. Android Native Modules : https://reactnative.dev/docs/native-modules-android

    2. Running a React Native App on Android Studio A Step-by-Step Guide : https://groovetechnology.com/blog/running-a-react-native-app-on-android-studio-a-step-by-step-guide/

    3. Dive into React Native for Android Development :
      https://www.toptal.com/react-native/react-native-for-android-development

    4. How to integrate Native modules in React Native Apps ? Explained : https://medium.com/@gopesh.jangid/how-to-integrate-native-modules-in-react-native-apps-explained-355bab3cab90#:~:text=To%20use%20the%20native%20module,name%20from%20the%20specified%20library

    5. Could not create task ‘:app:compileDebugKotlin’ : https://discuss.gradle.org/t/could-not-create-task-compiledebugkotlin/46992

    6. Import fails with GradleException: Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() : https://youtrack.jetbrains.com/issue/KTIJ-27599/Import-fails-with-GradleException-Cannot-use-TaskAction-annotation-on-method-IncrementalTask.taskActiongradlecore

    7. how to solve cannot use taskaction annotation on : https://slack-chats.kotlinlang.org/t/12356096/anyone-know-how-to-solve-cannot-use-taskaction-annotation-on

    8. Upgrading your build from Gradle 7.x to 8.0 :
      https://docs.gradle.org/current/userguide/upgrading_version_7.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search