Will this be in a release of the plugin, or do we have to wait for a new 
version of Android Studio?

On Wednesday, August 26, 2015 at 11:52:57 AM UTC-6, Raymond Chiu wrote:
>
> I am sorry for the experiences.  There are a number of fixes for the 
> upcoming release relating to library module.  It should be ready soon. 
>  Please give it another try when it is released.  Thanks.
>
>
> On Tuesday, August 25, 2015 at 1:42:02 PM UTC-7, Mark Melling wrote:
>>
>> I also had the same problem.
>>
>> As an experiment I built the library module as an application (using 
>> com.android.model.application), but leaving the build.gradle the same (as 
>> when building the library) and in this case the .so file was include in the 
>> built apk.
>>
>>
>>  
>>
>> On Friday, 7 August 2015 17:00:26 UTC+1, Florent Brunet wrote:
>>>
>>> Hi!
>>>
>>> I am investigating the new support of the NDK with the official 1.3 
>>> release of Android Studio. More precisely, I am trying to make a library 
>>> module which uses both Java code and native C code (interfaced with JNI). I 
>>> followed the explanations provided in this doc: 
>>> http://tools.android.com/tech-docs/new-build-system/gradle-experimental 
>>> (Unfortunately, it doesn't say much about libraries). So basically I have 
>>> an Android Studio project with two modules:
>>> - a main application (which uses com.android.model.application plugin)
>>> - a library module (which uses com.android.model.library plugin)
>>> (The main application does not have any native C code, only the library 
>>> module has.)
>>>
>>> Here are the problems I've got:
>>>
>>> *First case: I put all the NDK stuff in the build.gradle file of the 
>>> library module.*
>>> - The library seems to compile fine (Java and native parts -> the .so 
>>> files are present in the intermediate outputs)
>>> - An AAR file is built but it does not contain the .so files
>>> - The whole project does not compile: it stops on the 
>>> compileDebugJavaWithJavac task of the main app module complaining that it 
>>> cannot find the symbols defined in the library module.
>>>
>>> *Second case: I remove all the NDK stuff from the build.gradle file of 
>>> the library module.*
>>> That's silly considering what my final goal is, I did that just for 
>>> testing purposes.
>>> In this case, the compilation is successful: When the main app module is 
>>> compiled, the symbols defined in the library module are properly found (-> 
>>> from what I deduce that the dependencies configuration in the gradle files 
>>> should be OK...)
>>> The generated APK runs properly on the device (as long as the native 
>>> code from the library module is not used of course)
>>>
>>> I spent a lot of time trying to make that work without any success... 
>>> It's definitely not impossible that I'm doing something wrong but I've got 
>>> the feeling that there is something buggy and/or missing in the 
>>> gradle-experimental 0.2.0 plugin.
>>>
>>> The full source code of the minimal project I used to test the creation 
>>> of an AAR library containing native code is here: 
>>> https://gitlab.com/FlorentBrunet/trials-gradleexpe-lib-jni/tree/master
>>>
>>> And here are my build.gradle files:
>>> *- for the main app module:*
>>>
>>> apply plugin: 'com.android.model.application'
>>>
>>> model {
>>>     android {
>>>         compileSdkVersion = 22
>>>         buildToolsVersion = "22.0.1"
>>>
>>>         defaultConfig.with {
>>>             applicationId = "com.ubleam.trialswithlib"
>>>             minSdkVersion.apiLevel = 11
>>>             targetSdkVersion.apiLevel = 22
>>>             versionCode = 1
>>>             versionName = "1.0"
>>>         }
>>>     }
>>>
>>>     android.buildTypes {
>>>         release {
>>>             minifyEnabled = false
>>>             proguardFiles += file('proguard-rules.pro')
>>>         }
>>>     }
>>> }
>>>
>>> dependencies {
>>>     compile fileTree(dir: 'libs', include: ['*.jar'])
>>>     compile 'com.android.support:appcompat-v7:22.2.1'
>>>     compile project(':mylibrary')
>>> }
>>>
>>>
>>> *- for the library module:*
>>>
>>> apply plugin: 'com.android.model.library'
>>>
>>> model {
>>>     android {
>>>         compileSdkVersion = 22
>>>         buildToolsVersion = "22.0.1"
>>>
>>>         defaultConfig.with {
>>>             applicationId = "com.ubleam.mylibrary"
>>>             minSdkVersion.apiLevel = 11
>>>             targetSdkVersion.apiLevel = 22
>>>             versionCode = 1
>>>             versionName = "1.0"
>>>         }
>>>     }
>>>
>>>     android.ndk {
>>>         moduleName = "dummylib"
>>>     }
>>>
>>>     android.buildTypes {
>>>         release {
>>>             minifyEnabled = false
>>>             proguardFiles += file('proguard-rules.pro')
>>>         }
>>>     }
>>>
>>>     android.productFlavors {
>>>         // for detailed abiFilter descriptions, refer to "Supported ABIs" @
>>>         // https://developer.android.com/ndk/guides/abis.html#sa
>>>         create("arm") {
>>>             ndk.abiFilters += "armeabi"
>>>         }
>>>         create("arm7") {
>>>             ndk.abiFilters += "armeabi-v7a"
>>>         }
>>>         create("arm8") {
>>>             ndk.abiFilters += "arm64-v8a"
>>>         }
>>>         create("x86") {
>>>             ndk.abiFilters += "x86"
>>>         }
>>>         create("x86-64") {
>>>             ndk.abiFilters += "x86_64"
>>>         }
>>>         create("mips") {
>>>             ndk.abiFilters += "mips"
>>>         }
>>>         create("mips-64") {
>>>             ndk.abiFilters += "mips64"
>>>         }
>>>         // To include all cpu architectures, leaves abiFilters empty
>>>         create("all")
>>>     }
>>> }
>>>
>>> dependencies {
>>>     compile fileTree(dir: 'libs', include: ['*.jar'])
>>>     compile 'com.android.support:appcompat-v7:22.2.1'
>>> }
>>>
>>>
>>> Really hope that this could help improving the Android tools because, 
>>> except for these few problems, Android Studio 1.3 and the integration of 
>>> the NDK is amazing!
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to