I've been learning Android over the past few months and have been using Eclipse Juno as my IDE.
I am trying to migrate to Android-Studio and wonder how I can "exclude from build path" some of the classes I have yet to complete?
In Eclipse, it was straight forward right click. I can't find any reference to it in Studio.
Just specify the group , the module and the version , like you do for dependencies. If you just want to exclude one class for a dependency jar, take a look at the jar jar links tool and its Gradle plugin. It allows you to alter included jars, e.g. to change packages or remove classes.
Open Project Structure ( Ctrl + Alt + Shift + S in Linux) → Modules → Sources tab. However, if you would like to exclude only one class, use the Gradle build file.
minify is an Android tool that will decrease the size of your application when you go to build it. It's extremely useful as it means smaller apk files! It detects any code or libraries that aren't being used and ignores them from your final apk.
What is R8? R8 is an app shrinking tool that is used to reduce the size of your application. This tool present in Android Studio works with the rules of Proguard. R8 will convert your app's code into optimized Dalvik code.
AFAIK IntelliJ allows to exclude packages. Open Project Structure (Ctr+Alt+Shift+S in Linux) > Modules > Sources Tab.
However if you would like to exclude only one class use Gradle build file.
Android Studio uses Gradle so in build.gradle file add inside android configuration custom SourceSet that excludes your class e.g:
android { compileSdkVersion 19 buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 19 targetSdkVersion 19 packageName "org.homelab.lab" testPackageName "org.homelab.lab.test" } sourceSets { main { java { exclude '**/SomeExcludedClass.java' } } androidTest { java { exclude '**/TestSomeExcludedClass.java' } } } }
Works fine with Android Studio v3.0
apply plugin: 'com.android.application' android { defaultConfig {...} buildTypes {...} sourceSets { main { java { exclude 'com/example/full/package/path/MainActivity.java' } } } }
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