Recompile with -Xlint in Android Studio

Android Studio 3.1 Run not compiling code

I have solution for your issue.

Also confirmed by Android Studio on Twitter : https://twitter.com/androidstudio/status/981914632892960768

  1. Edit your app configuration as below.

Sample Image


  1. Here you can see your app configuration as below.

Sample Image


  1. Here is missing Gradle-aware make attribute in before launch configuration. You can see here.

Sample Image


  1. Please add this Gradle-aware Make attribute through this way. Click on + icon and select Gradle-aware Make as seen in this screen.

Sample Image


  1. You can add this without writing any task just press OK button and task will be added and now it should look like this. Now apply changes and run your application.

Sample Image

It will solve this old apk installing issue on clean build in new Android Studio 3.1 issue.

Note : This issue is resolved in new Android Studio 3.1.1 Stable release.

how to solve compile error android studio?

Set your compileSdkVersion to 25 or change the libraries to an appropriate 24 API level build

Android studio compile takes forever

Try set org.gradle.jvmargs setting in gradle.properties like the following:

org.gradle.jvmargs=-Xmx3g

Please pay attention that the first build of a big project after cleanup can take up to 10 mins or even a little more.

Some other tips:

  • update Android Gradle Plugin to the latest stable version (currently 7.1.3) and Gradle Version (currently 7.2). Refer to this document.

  • update Kotlin version to 1.6.10 or later.

  • update Android Studio and Build-Tools.

  • use JavaVersion.VERSION_11 for sourceCompatibility and targetCompatibility:

    compileOptions {
    sourceCompatibility JavaVersion.VERSION_11
    targetCompatibility JavaVersion.VERSION_11
    }

    kotlinOptions {
    jvmTarget = "11"
    ...
    }
  • set android.enableJetifier=false in grade.properties.

Why am I getting this Android Studio error: recompile with -fPIC?

Your compile step includes the following:

-fPIC -fPIE

I believe what is happening is that the latter is overriding the former. PIE is only valid for executables, not libraries.

I think the -fPIE flag is probably coming from your build scripts? The NDK CMake toolchain file does append -fPIE, but only for executables.

Android Studio - java module recompiled on each application recompile

there're two steps to achieve what u want:

  1. Ask the android plugin to pre-dex the libraries.

so you add dexOptions inside the android bracket

android {
dexOptions {
preDexLibraries true
}
}

  1. and the other step is to make your debug build to be minSdkVersion 21, that way the system will build as a multi-dex application so it won't need to merge your dexed library into the APK.

There's a whole section on the dev page about it https://developer.android.com/studio/build/multidex.html#dev-build, but what you want to do is add productFlavors inside the android bracket

android {
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion YOUR_APP_MINIMUM_HERE
}
}
}

How to prevent from C++ to recompile all files in Android NDK?

Finally I have found the cause to the problem.

In my project I have worked with symlink C++ files.
The NDK cannot immediately apply the changes made in these files and they
won't be expressed in your app unless you rebuild the whole project.

The solution is to work with hard copy files.

If I find some way to work correctly with symlink files it would be better
for my needs. Until then I can at least edit single or multiple files without recompiling the whole project.

This is a relatively esoteric situation but might be helpful for
someone in the future.



Related Topics



Leave a reply



Submit