Hi Raymond,
I'll try to clarify:
My SDK module contains Java and C++, and will be compiled to a Android
library (AAR) file. This is working fine, output is as expected (I unzip
the compiled AAR, and I can find the Java classes and .so files that I
need).
The App modules is pure Java, no C++, and will be compiled to an APK.
When I try to use this SDK module in my App Module, the App module does not
compile.
The error that I get is:
error: package com.company.sdk.package does not exist
... and that for every usage of a SDK class or package.
When I inspect my project on disk, I cannot see the SDK files in the
'exploded-aar' directory in the app module's build/intermediates directory.
I do have a work-around:
Only when I manually copy the AAR file to my (self-created) libs directory,
and add the extra line to the dependency section of the App build.gradle,
it does work, but this is highly inconvenient.
I hope that I have clarified the issue a bit.
Kind regards,
Maurice
Op maandag 9 november 2015 21:23:19 UTC+1 schreef Raymond Chiu:
>
> Hi Maurice,
>
> Can you clarify what do you mean when you say "My issue is that when I try
> to compile the app, it fails, saying that my SDK packages do not exist."?
> Does your app contains C++ code that depends on the SDK? Or is it pure
> Java and uses the Java wrapper provided by the SDK?
>
> It should work if it's the latter. Please let me know the error message
> you see. Thanks.
>
> Raymond
>
>
> On Friday, November 6, 2015 at 7:53:57 AM UTC-8, Maurice Wingbermühle
> wrote:
>>
>> Hi Guys,
>>
>> I'm working on converting a existing Eclipse project to Android Studio,
>> to be able to debug my C++ SDK more easily.
>> We already have it compiling with the Android NDK for well over a year
>> using a set of Android.mk files, but for this case, we want to be able to
>> embed the SDK in an Android app to test and debug.
>>
>> I'm using Android Studio 1.5 beta and currently Gradle 2.6 and
>> gradle-experimental:0.3.0-alpha7 wrapper.
>>
>> I also have a project in Android Studio already, in which I jammed all
>> sources together in 1 module, but the project is packed with symlinks and
>> is not really portable, and hard to setup for other developers.
>> So I decided to start over and build the project configuration from
>> ground up. I'm using a Android Library Module for the SDK, which is used by
>> the Android Application module (test app).
>>
>> The SDK module consists of a C++ core, with a JNI and Java wrapper around
>> it.
>> The module compiles and works fine - all output is nicely generated into
>> an AAR file in build/outputs/aar/
>>
>> My issue is that when I try to compile the app, it fails, saying that my
>> SDK packages do not exist.
>>
>> My app gradle files looks like this:
>>
>> apply plugin: 'com.android.model.application'
>>
>> model {
>> android {
>> compileSdkVersion = 19
>> buildToolsVersion = "23.0.1"
>>
>> defaultConfig.with {
>> applicationId = "com.mycompany.myapp"
>> minSdkVersion.apiLevel = 15
>> targetSdkVersion.apiLevel = 19
>> versionCode = 1
>> versionName = "1.0"
>> }
>>
>> }
>>
>> android.buildTypes {
>> release {
>> minifyEnabled = false
>> proguardFiles += file('proguard-rules.pro')
>> }
>> debug {
>> debuggable = true
>> ndk.with {
>> debuggable = true
>> }
>> }
>> }
>>
>> android.sources {
>> main {
>> java {
>> source {
>> srcDirs += 'src'
>> }
>> }
>> }
>> }
>> }
>>
>> dependencies {
>> compile project(':sdk')
>> compile project(':sdk-testing')
>> compile fileTree(dir: 'libs', include: ['*.jar'])
>> compile 'com.android.support:support-v4:19.1.0'
>> compile 'com.android.support:appcompat-v7:19.1.0'
>> }
>>
>> tasks.withType(JavaCompile) {
>> sourceCompatibility = JavaVersion.VERSION_1_7
>> targetCompatibility = JavaVersion.VERSION_1_7
>> }
>>
>>
>>
>> My SDK gradle files looks like this:
>>
>>
>> apply plugin: 'com.android.model.library'
>>
>> model {
>> android {
>> compileSdkVersion = 19
>> buildToolsVersion = "23.0.1"
>>
>> defaultConfig.with {
>> versionName = '1.0'
>> }
>> }
>>
>> android.ndk {
>> moduleName = "sdk"
>> toolchain = "gcc"
>> cppFlags += ["-D ANDROID_LOGCAT=1",
>> "-DGRADLE",
>> "-std=c++11",
>> "-frtti",
>> "-fexceptions",
>> "-I${projectDir}/../../../".toString(),
>> "-I${projectDir}/../../../src".toString(),
>> ldFlags += ["-Lsrc/main/jniLibs/armeabi"]
>> ldLibs += ["log", "atomic"]
>> stl = "c++_shared"
>> }
>>
>> android.sources {
>> main {
>> // Java sources
>> java.source.srcDirs += '../../../external/src'
>>
>> // local folder with symlinks, created by gradle task
>> :sdk:createLinks
>> jni.source.srcDirs += 'src/cpp'
>> }
>> }
>>
>> android.productFlavors {
>> create("all") {
>> }
>> }
>>
>> android.buildTypes {
>> release {
>> minifyEnabled = false
>> }
>> debug {
>> debuggable = true
>> ndk.with {
>> debuggable = true
>> }
>> }
>> }
>> }
>>
>> dependencies {
>> compile fileTree(dir: 'libs', include: ['*.jar'])
>> }
>>
>> tasks.withType(JavaCompile) {
>> sourceCompatibility = JavaVersion.VERSION_1_7
>> targetCompatibility = JavaVersion.VERSION_1_7
>> }
>>
>> task createLinks(type:Exec) {
>> workingDir 'scripts'
>> commandLine './createLinks.sh'
>>
>> standardOutput = new ByteArrayOutputStream()
>> ext.output = {
>> return standardOutput.toString()
>> }
>> }
>>
>> tasks.whenTaskAdded { task
>>
>> ...
>
>
--
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.