clipboard icon indicating copy to clipboard operation
clipboard copied to clipboard

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. Namespace not specified.

Open tapz opened this issue 2 years ago • 8 comments

Environment

info Fetching system and libraries information...
(node:19293) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
  OS: macOS 13.5.1
  CPU: (12) arm64 Apple M2 Max
  Memory: 28.64 GB / 96.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.nvm/versions/node/v18.17.1/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.nvm/versions/node/v18.17.1/bin/npm
  Watchman:
    version: 2023.08.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 11.3.7
    wanted: ^11.3.7
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Platforms

Android

Versions

  • react-native-netinfo:
  • react-native: 0.72.4
  • react: 18.2.0

Description

2: Task failed with an exception.
-----------
* What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
> Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@51645e1d of type BuildFlowService.Parameters
   > A problem occurred configuring project ':react-native-clipboard_clipboard'.
      > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
         > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
           
           If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

Reproducible Demo

tapz avatar Sep 05 '23 15:09 tapz

I got the same issue :(

sten-nico avatar Sep 06 '23 11:09 sten-nico

Downgrading to Gradle wrapper 8.2.1 helped. 8.3 does not seem to work with React Native.

tapz avatar Sep 06 '23 11:09 tapz

Doesnt works for me. Can someone just add a namespace to the build.gradle?

Kinqdos avatar Oct 26 '23 09:10 Kinqdos

Same issue here. Any solution?

Aymkdn avatar Dec 04 '23 15:12 Aymkdn

I have the same issue

grant-devon avatar Jan 03 '24 11:01 grant-devon

I had the same problem when I import opencv module. Then I add some code to the build.gradle(opencv) file, and my problem solved:

android { namespace 'com.example.mytestapp' // added compileSdk 34 ...

littlefrogyq avatar Mar 12 '24 13:03 littlefrogyq

This comes up when upgrading Android Gradle Plugin to >= 8.

Updating the package to try to solve this will add two new peerDependencies from 1.14.0: "react-native-macos": "^0.73.0", "react-native-windows": "^0.73.0"

Why do I need to install these two when they are not used? I don't develop for windows. And this change is breaking too, and there is no mentions/docs for the new version.

eisodev avatar Apr 16 '24 06:04 eisodev

the problem comes from an incompatibility of the package with the new version of gradle to correct this you must change the version of gradle in the flutter project more precisely in "androïd/gradle/wrapper/gradle-wrapper.properties" it looks like this: "distributionUrl=https://services.gradle.org/distributions/gradle-7.6.3-all.zip". you must then go to the Settings.gradle file and modify the second line in the plugins like this: id "com.android.application" version "7.3.0" apply false. well before doing all these steps you must delete the .gradle folder located in the android folder

abdoul-kader1 avatar Oct 19 '24 01:10 abdoul-kader1