I am trying to convert my project from Eclipse over Android Studio. My main project is using Jira Mobile Connect for Android as a module.
My main project AndroidManifest.xml has a reference to strings in a Module project (Library project in Eclipse).
<activity
android:name="com.atlassian.jconnect.droid.activity.FeedbackActivity"
android:label="@string/jconnect.droid.create_feedback" >
</activity>
I am getting the following error.
android-apt-compiler: [MyProject] C:\dev\projects\android\MyProject\AndroidManifest.xml:92: error: Error: No resource found that matches the given name (at 'label' with value '@string/jconnect.droid.create_feedback').
I can run "gradle assemble" from the command line without errors.
Here is my project build.gradle file.
buildscript {
println 'Running gradle.'
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project('../jiraconnect-android/jiraconnect-android-main')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
I also have a settings.gradle file:
include ':MyHouse', '../jiraconnect-android/jiraconnect-android-main'
My Jira Mobile Connect module has the following build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 8
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
You are going to want to set the other module as such in Android Studio. You do this by making sure the submodule has a build.gradle, you mention the project name in your main project's settings.gradle, and you set the submodule as a dependency in the main project's build.gradle. With all that done when the project assembles (assembleResources to be exact) all strings.xml files will get combined into one and all strings defined in your submodule will be brought in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With