I am putting together an android plugin for cordova using the cli that uses a third party aar and am getting symbol does not exist errors.
我正在整理一个用于cordova的android插件,使用cli使用第三方aar并且我得到的符号不存在错误。
As best that I can work out it is because cordova's build needs to be told that there is an an aar in libs. It needs to be included on the classpath.
我最好能解决这个问题,因为需要告知cordova的构建版本中有一个字母。它需要包含在类路径中。
Normally any configuration changes required by a plugin would be made in plugin.xml. Does anyone know what I need to set to tell cordova about the aar.
通常,插件所需的任何配置更改都将在plugin.xml中进行。有谁知道我需要设置告诉cordova关于aar。
(I have checked and the aar is actually in project/libs as a result of the plugin line)
(我已经检查过,并且aar实际上是在插件行中的项目/库中)
<source-file src="libs/android/mopub-sdk.aar" target-dir="libs" />
or is my problem a little deeper and its not a plugin.xml problem - its something I need to configure in cordova cli?
或者我的问题更深一点,它不是一个plugin.xml问题 - 我需要在cordova cli中配置它?
1 个解决方案
#1
0
Okay, I have a similar problem. What works for me was adding this .aar to a folder named 'aars' inside the root/platforms/android folder. And also creating the build-extras.gradle file (you have to create this file on the root/platforms/android folder) with the following code:
好的,我有类似的问题。对我有用的是将.aar添加到root / platforms / android文件夹中名为'aars'的文件夹中。还使用以下代码创建build-extras.gradle文件(您必须在root / platforms / android文件夹上创建此文件):
ext.postBuildExtras = {
android {
repositories {
mavenCentral()
flatDir {
dirs 'aars'
}
}
dependencies {
compile 'io.filepicker:filepicker-android:3.8.14@aar'// IN YOUR CASE, PUT THE CORRECT NAME THAT MATCHS YOURS AAR
}
}
Now, when it compiles, it gets the .aar and set up in the build path. If yours aar uses a thrid library, you should include (copy/paste to libs) folder. You have to make this to include those libraries on the build-path so it will be on the .apk when you generated. Now, you just need to import the /platforms/android folder in the eclipse, and then click with the right button on the project>properties>JAva build path>order and export. Now you just need to check Android private libraries and you're good to go.
现在,当它编译时,它获取.aar并在构建路径中设置。如果你的aar使用thrid库,你应该包括(复制/粘贴到libs)文件夹。你必须使它在构建路径中包含这些库,以便在生成时它位于.apk上。现在,您只需要在eclipse中导入/ platforms / android文件夹,然后单击项目上的右键>属性> JAva构建路径>命令并导出。现在您只需要检查Android私有库,就可以了。
Hope it helps you.
希望它能帮到你。
#1
0
Okay, I have a similar problem. What works for me was adding this .aar to a folder named 'aars' inside the root/platforms/android folder. And also creating the build-extras.gradle file (you have to create this file on the root/platforms/android folder) with the following code:
好的,我有类似的问题。对我有用的是将.aar添加到root / platforms / android文件夹中名为'aars'的文件夹中。还使用以下代码创建build-extras.gradle文件(您必须在root / platforms / android文件夹上创建此文件):
ext.postBuildExtras = {
android {
repositories {
mavenCentral()
flatDir {
dirs 'aars'
}
}
dependencies {
compile 'io.filepicker:filepicker-android:3.8.14@aar'// IN YOUR CASE, PUT THE CORRECT NAME THAT MATCHS YOURS AAR
}
}
Now, when it compiles, it gets the .aar and set up in the build path. If yours aar uses a thrid library, you should include (copy/paste to libs) folder. You have to make this to include those libraries on the build-path so it will be on the .apk when you generated. Now, you just need to import the /platforms/android folder in the eclipse, and then click with the right button on the project>properties>JAva build path>order and export. Now you just need to check Android private libraries and you're good to go.
现在,当它编译时,它获取.aar并在构建路径中设置。如果你的aar使用thrid库,你应该包括(复制/粘贴到libs)文件夹。你必须使它在构建路径中包含这些库,以便在生成时它位于.apk上。现在,您只需要在eclipse中导入/ platforms / android文件夹,然后单击项目上的右键>属性> JAva构建路径>命令并导出。现在您只需要检查Android私有库,就可以了。
Hope it helps you.
希望它能帮到你。