I'm using Intellij IDEA 14.1.4 to make an Android project after moving from Android Studio a while back. I made some libraries (through Android Studio) and would like to use them in Intellij.
However, it seems that Intellij only accepts .jar
files through the libs
folder, and Android Studio only creates .aar
files.
In Android Studio, one has the option (when creating a new module) to import an existing .jar/.aar
package to be put into a new module. This option doesn't seem to be in intellij. This user seems to think that Intellij supports that, but those instructions allow me to create a brand new Gradle module. What I want to do is use an existing .aar
file.
What should I go about doing? Should I move back to Studio for this project, or is there a way for me to use these .aar
files?
P.S. Intellij can't process raw aar
s, period. I tried adding this to my gradle files, but got an error:
compile fileTree(dir: 'libs', include: ['*.aar'])
Edit
Here's my build.gradle
:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
flatDir() {
dirs 'libs'
}
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile ':mylib@aar'
compile 'com.android.support:appcompat-v7:22.2.0'
}
preDexDebug
phase of the gradle build