我想用我的React Native Android应用程序包含一个AAR文件,以便我可以使用本机代码访问其功能。我如何打包AAR,以便本地代码可以使用React Native Android导入它?谢谢!如何在React Native Android构建中包含AAR?
我得到的错误编译时是这样的:
~\app\android\app\src\main\java\com\grind\GrindModule.java:13: error: package com.estimote.sdk does not exist
import com.estimote.sdk.EstimoteSDK;
^
我已经做了以下修改:
创建android/app/libs/estimote-sdk.aar
。
创建反应原生本机模块(我已经做了几次之前,它工作正常,直到我尝试使用SDK)。
dependencies {
compile(name:'estimote-sdk', ext:'aar')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
android/build.gradle
...
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
flatDir {
dirs 'libs'
}
}
}
这些是包括SDK的说明: https://github.com/Estimote/Android-SDK#installation
嘿,你能解决这个问题吗? – Micer
嗨@Micer看到我刚刚发布的答案。 –