facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.3k stars 24.35k forks source link

After upgrading from 0.72 to 0.74 project RN can not recognize .aidl native module files #45848

Closed nahlebn1k closed 3 months ago

nahlebn1k commented 3 months ago

Description

Hello, we used License Verification Library (LVL) in our project before in 0.72 version. But after upgrading to 0.74 React Native can not compile this lib and not recognizing .aidl interface package of this lib. Can you please provide any solution to this problem? Thanks in advance!

https://developer.android.com/google/play/licensing/overview - Licensing library

Steps to reproduce

  1. Build android app npm run android

React Native Version

0.74.4

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: Windows 11 10.0.22631
  CPU: "(12) x64 AMD Ryzen 5 5600H with Radeon Graphics         "
  Memory: 1.03 GB / 13.86 GB
Binaries:
  Node:
    version: 18.17.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 9.6.7
    path: C:\Program Files\nodejs\npm.CMD
  Watchman:
    version: 20231008.002904.0
    path: C:\ProgramData\chocolatey\bin\watchman.EXE
SDKs:
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Google APIs Intel x86_64 Atom
      - android-33 | Google Play Intel x86_64 Atom
      - android-34 | Google APIs Intel x86_64 Atom
      - android-34 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-232.10227.8.2321.11479570
  Visual Studio:
    - 17.7.34031.279 (Visual Studio Community 2022)
Languages:
  Java: 17.0.10
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

> Task :app:compileReleaseJavaWithJavac FAILED
project\android\app\src\main\java\com\google\android\vending\licensing\LicenseChecker.java:33: error: package com.android.vending.licensing does not exist
import com.android.vending.licensing.ILicenseResultListener;
                                    ^
project\android\app\src\main\java\com\google\android\vending\licensing\LicenseChecker.java:34: error: package com.android.vending.licensing does not exist
import com.android.vending.licensing.ILicensingService;
                                    ^
project\android\app\src\main\java\com\google\android\vending\licensing\LicenseChecker.java:72: error: cannot find symbol
    private ILicensingService mService;
            ^
  symbol:   class ILicensingService
  location: class LicenseChecker
project\android\app\src\main\java\com\google\android\vending\licensing\LicenseChecker.java:242: error: package ILicenseResultListener does not exist     
    private class ResultListener extends ILicenseResultListener.Stub {
                                                               ^
project\android\app\src\main\java\com\google\android\vending\licensing\LicenseChecker.java:321: error: package ILicensingService does not exist
        mService = ILicensingService.Stub.asInterface(service);
                                    ^
Note: project\android\app\src\main\java\com\google\android\vending\licensing\LicenseChecker.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Reproducer

https://github.com/nahlebn1k/aidl-issue

Screenshots and Videos

No response

cortinico commented 3 months ago

That's because we bumped the Android Gradle Plugin version which now requires you to enable AIDL explicitly (it's turned off by default).

The fix is to go here: https://github.com/nahlebn1k/aidl-issue/blob/d9d8d35f7764dcd9facb1a893754e8514e043539/android/app/build.gradle#L105

and add the following:

+   buildFeatures {
+     aidl = true
+   }
}

See more on this here: https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes