I have an android project named projectA.
I use compile project(':projectB') in build.gradle of projectA.
I have use minifyEnabled true in projectA.
Do I need minifyEnabled true in projectB?
In my opinion, you only need to declare the minifyEnabled true in projectB if you have the proguard rule in the project B. If not, you don't need to do it.
Android Studio provide us the way to define proguard in many project.
Related
I'm trying to write code inspection for Kotlin for IntelliJ IDEA. I need to use AbstractKotlinInspection which is from
import org.jetbrains.kotlin.idea.inspections
The code is from https://github.com/JetBrains/kotlin/blob/master/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/AbstractKotlinInspection.kt
What library should I include (depend on in build.gradle) to get access to AbstractKotlinInspection?
Just include the below in the intellij section of build.gradle
plugins 'kotlin'
e.g.
intellij {
version '2018.1.4'
pluginName 'ElyePlugin'
plugins 'kotlin'
updateSinceUntilBuild false
alternativeIdePath "/Applications/Android Studio.app/Contents/"
}
I am new to Dagger2 and I am trying to use it in my Kotlin project (1.1.51). I followed a few tutorials and all is good.
I have these in my gradle file and I am using Android Studio 3.01, I have to use gradle-3.3
apply plugin: 'kotlin'
apply plugin: 'kotlin-allopen'
apply plugin: 'kotlin-kapt'
compile 'com.google.dagger:dagger:2.11'
kapt 'com.google.dagger:dagger-compiler:2.11'
kapt {
generateStubs = true
}
I can successfully run my project and Dagger2 seems to be working. The only annoying issue is that the Dagger created classes always come up as red on the import list. e.g DaggerMainComponent.
import com.burfdevelopment.hack24.Dagger.MainComponent
import com.burfdevelopment.hack24.Dagger.MainModule
import com.burfdevelopment.hack24.Dagger.DaggerMainComponent
So if do a code tidy which removes unused imports it always removes it even though its being used. If I click on the DaggerMainComponent, it does go to the generated class.
I think that there's an issue with the configured folders in Android Studio. In particular, in your build.gradle file you should have something like this (I used it in my IntelliJ Idea projects, but it should work also in Android Studio):
// Configure Dagger generated files
ideaModule.module.generatedSourceDirs += file("$buildDir/generated/source/kapt/main")
In this way, you are telling your IDE to mark as "generated sources", the source files under that folder (which is where Kapt puts generated files like your DaggerMainComponent)
After changing my top level build.gradle to use the Android Plugin for Gradle 3.0.0-beta3 along with Gradle 4.1, AirWatch can't read the info (like versionCode and versionName) from the APK.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
roomVersion = '1.0.0-alpha9'
supportLibVersion = '26.0.1'
}
Is this a known issue? Any workaround?
Airwatch has an issue with the new AAPT2 tool which seems to compile the Manifest.xml file in a compressed form in contrast to AAPT. AAPT2 became the standard with Android Studio 3 but you can get back easily to AAPT by putting the line
android.enableAapt2=false
in the gradle.properties file of your project. Solved at least in our project the problem.
I don't have enough reputation to comment, but I just wanted to ask, if you have found out anything new about this topic, since our clients use AirWatch and we have run into a similar problem after updating gradle.
Specifically after updating from Android Studio 2 to Android Studio 3 and thus changing all gradle stuff coming with it.
As of this writing, Airwatch has a limitation where it will not update the app compiled with Android gradle plugin 3.0.
There are 2 work arounds.
1. Build the apk using the gradle plugin 2.3.3
or
2. Upload the apk built using gradle plugin 3.0 as a separate app on the console. Define App/ID version code manually and deploy.
In my build.gradle, I have three build types:
buildTypes {
debug {
applicationIdSuffix ".debug"
debuggable true
}
release {
minifyEnabled false
}
beta {
applicationIdSuffix ".beta"
debuggable true
}
}
For all three build types, I have different icons in mipmap-xxx directories. The idea is, if I install all the three apks on the same device, I can easily identify each app.
When I run gradle to build the apks, I see that the icon files in the intermediate directory for beta have been merged properly. However, the ones for debug build\intermediates\res\merged\debug\mipmap-xxxstill use the original images for "release."
I am wondering if "debug" build type is special and if there is a way to tell gradle to merge the icons. Regards.
Note that the string table does get merged properly for all the build types.
It turns out I made a mistake in the directory layout. The proper layout must be as follows:
src/
main/
java/
res/
values/
mipmap-xxx/
beta/
res/
values/
mipmap-xxx/
debug/
res/
values/
mipmap-xxx/
What is the best procedure for beginning a new Gradle project in IntelliJ IDEA 12.1.3?
I created a skeleton build.gradle file with the idea plugin to generate the project files:
apply plugin: 'java'
apply plugin: 'idea'
task wrapper(type: Wrapper) {
gradleVersion = '1.6'
}
When I open the new project IntelliJ complains that the Groovy SDK is not configured for module:
After configuring the Groovy SDK I get Java inspection issues in the build file:
Am I doing something wrong or is this normal for a Gradle based project in IDEA? Should I just disable inspection?
UPDATE
I was able to import a skeleton project and IDEA automatically configured everything properly. However I am still receiving Java inspection errors in build.gradle as shown above.
If you use Gradle's idea task to generate project files, this is normal, as there is no way to tell IDEA what the class path of the build script itself is. If you instead use IDEA's Gradle integration ("Import from Gradle model"), this problem doesn't exist.
This question was asked anout a year ago for IDEA 12, and at that time the Gradle support was still... let's say "in progress". In the meantime IDEA 13 is out, and the Gradle support plugin has improved dramatically. See this (short) video for the current capabilities: https://m.youtube.com/watch?v=3Euo6xzCwY4 It isn't a stupid menu walkthrough, it is a concrete example.