qiuxiang / react-native-amap3d

react-native 高德地图组件,使用最新 3D SDK,支持 Android + iOS
https://qiuxiang.github.io/react-native-amap3d/api/
MIT License
1.27k stars 327 forks source link

Build failed with an exception #817

Open liuzhoou opened 7 months ago

liuzhoou commented 7 months ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-amap3d@3.2.4 for the project I'm working on.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':react-native-amap3d'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
   > Namespace not specified. Please specify a namespace in the module's build.gradle file like so:

     android {
         namespace 'com.example.namespace'
     }

     If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
error Failed to install the app.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-amap3d/lib/android/build.gradle b/node_modules/react-native-amap3d/lib/android/build.gradle
index a6e84de..056e27b 100644
--- a/node_modules/react-native-amap3d/lib/android/build.gradle
+++ b/node_modules/react-native-amap3d/lib/android/build.gradle
@@ -18,6 +18,7 @@ buildscript {
 }

 android {
+    namespace 'qiuxiang.amap3d'
     compileSdkVersion getExt('compileSdkVersion', 33)
     buildToolsVersion getExt('buildToolsVersion', '33.0.0')

This issue body was partially generated by patch-package.