How to detect Android Gradle dependencies that have newer versions available? - android-studio

I manage my Android app and associated modules Gradle dependencies using Gradle ext{} variables.
for example
ext {
compileSdkVersion = 28
targetSdkVersion = 28
minSdkVersion = 21
buildToolsVersion = "28.0.3"
supportLibVersion = '1.0.2'
coreKtx = '1.0.2'
materialMaterial = "1.0.0"
legacySupportV4 = "1.0.0"
recyclerView = "1.0.0"
lifecycleExtensions = "2.0.0"
playServicesAuthVersion = "16.0.1"
archLifecycleVersion = '2.0.0'
roomVersion = '2.1.0-beta01'
archPagingVersion = '2.1.0'
archWorkerRuntimeVersion = "1.0.1"
constraintLayoutVersion = '1.1.3'
browserVersion = '1.0.0'
appCompatVersionXXX = '1.1.0-alpha03'
appCompatVersion = '1.0.2'
...
Android studio "sometimes" highlights a dependency where a newer version is available, however this doesn't appear to be consistent.
I've tried using Android Studio Analyze > Run Inspection by Name > Newer Library Versions Available, however that doesn't work at all.
The version of Android Studio is
Android Studio 3.4
Build #AI-183.5429.30.34.5452501, built on April 10, 2019
JRE: 1.8.0_152-release-1343-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.4
How can I detect out of date library versions in Android Studio consistently?

Hector,
Android Studio 3.4 has this screen where you can see updated version of your dependency.

Go to File -> Project Structure -> Select Dependencies
In this section, if you see a gray color underline in any dependencies name, that means it has a new update as said above.Update Underline

Related

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' in flutter

Flutter was working perfectly on previous device. I have changed my laptop, after all the setup I am getting this error I am unable to understand this error.
please explain what is this error for.
Solution for this error
I am just running very basic application.
app gradle
> def localProperties = new Properties() def localPropertiesFile =
> rootProject.file('local.properties') if (localPropertiesFile.exists())
> {
> localPropertiesFile.withReader('UTF-8') { reader ->
> localProperties.load(reader)
> } }
>
> def flutterRoot = localProperties.getProperty('flutter.sdk') if
> (flutterRoot == null) {
> throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }
>
> def flutterVersionCode =
> localProperties.getProperty('flutter.versionCode') if
> (flutterVersionCode == null) {
> flutterVersionCode = '1' }
>
> def flutterVersionName =
> localProperties.getProperty('flutter.versionName') if
> (flutterVersionName == null) {
> flutterVersionName = '1.0' }
>
> apply plugin: 'com.android.application' apply plugin: 'kotlin-android'
> apply from:
> "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
>
> android {
> compileSdkVersion 29
>
> sourceSets {
> main.java.srcDirs += 'src/main/kotlin'
> }
>
> lintOptions {
> disable 'InvalidPackage'
> }
>
> defaultConfig {
> // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
> applicationId "com.example.flutter_app"
> minSdkVersion 16
> targetSdkVersion 29
> versionCode flutterVersionCode.toInteger()
> versionName flutterVersionName
> }
>
> buildTypes {
> release {
> // TODO: Add your own signing config for the release build.
> // Signing with the debug keys for now, so `flutter run --release` works.
> signingConfig signingConfigs.debug
> }
> } }
>
> flutter {
> source '../..' }
>
> dependencies {
> implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }
android gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Logcat:
Please configure Android SDK
Terminal report
C:\Users\HP\StudioProjects\flutter_app>flutter run
Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 in debug mode...
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\HP\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 29 in C:\Users\HP\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 29 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\HP\AppData\Local\Android\sdk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 2.5s
Exception: Gradle task assembleDebug failed with exit code 1
Flutter doctor - V
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.18362.1082], locale en-US)
• Flutter version 1.22.0 at C:\src\flutter
• Framework revision d408d302e2 (4 days ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\HP\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 50.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.49.2)
• VS Code at C:\Users\HP\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
! Doctor found issues in 1 category.
Run this command to accept all license from Android.
flutter doctor --android-licenses and download sdk manager and build tools from Android studio
Apparently, what you can do is simply head to your Android SDK directory
and
cd "/tools/bin"
and run the following command
sdkmanager --licenses
and let the terminal do its job !
Here is the main problem
Failed to install the following Android SDK packages as some licenses have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
As the error suggests, first accept all licenses by running the following command
flutter doctor --android-licenses
next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3
After downloading extract the zip file into C:\Android\Sdk\build-tools\28.0.3 if you are on windows and /Library/Android/sdk/build-tools/28.0.3 if you are on mac
finally, download the missing Android SDK platform 29 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-29 if you are on mac or C:\Android\Sdk\platforms\android-29 if you are on windows
Run your project (flutter run) and enjoy

arm64-v8a Build Variant not showing up in Android Studio

How can I make arm64-v8a show up in Build Variant section?
I'm using the following setup on macOS:
Android Studio 3.4.1
Gradle Version 3.3
android-ndk-r15c
compileSdkVersion = 25
put this code in build gradle
splits {
abi {
enable true
reset()
include "x86", "armeabi-v7a", "arm64-v8a", "x86_64"
}
}
Documentation

How to fix "Unable to load class 'com.android.builder.errors.EvalIssueReporter'." error on Android Studio 3.2.1

I use IntelliJ IDEA for creating #Flutter projects and I have the Android Studio for installation purposes of Flutter onto my machine. The problem arose when I upgraded the Android Studio from 3.1.4 to 3.2.1. Moreover, after this upgrade, I'm no longer able to create any project in both IDEs.
The error message in IntelliJ
The error message in Android Studio
P.S. Those are the default programs of both IDEs namely, IntelliJ and Android Studio.
any newly-created project brings up this error; however, previously-created projects work perfectly fine.
My machine has 64-bit OS, x64-based Processor
IntelliJ
IntelliJ IDEA 2018.3.3 (Community Edition)
Build #IC-183.5153.38, built on January 9, 2019
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Android Studio
Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 9, 2018
JRE: 1.8.0_152-release-1136-b06 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
project's build.gradle file:
// 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.2.1'
// 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
}
the individual module build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.nonna.myapplication"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
}
I have checked those questions but unfortunately, the error wasn't fixed.
Build errors after Android Studio 3.2.1 upgrade
Could not find com.android.tools.build:aapt2:3.2.0
This issue got solved and now the IDE is working like a charm.
As it was seen from the provided screenshots there was an error in the Android Gradle plugin, so to solve this issue follow the numbered steps in the newly provided screenshots below.
(Part 1) Solving gradle issue due to upgrading Android Studio to 3.2.1
Step 0: From the left panel in your IDE, choose the android
[name_of_project] folder
Step 1: look for the build.gradle file then double click it to
start editing it
Step 2: change exactly the line that states
classpath
'com.android.tools.build:gradle:3.2.1' to the current version of
your Android Studio, in other terms, classpath
'com.android.tools.build:gradle:3.3.0' in my case.
(Part 2) Solving gradle issue due to upgrading Android Studio to 3.2.1
Step 3: After finishing from Steps 1 & 2, go to the gradle folder
Step 4: Double click on the wrapper subfolder
Step 5: Click the gradle-wrapper.properties file to start editing
it
Step 6: make sure that your gradle version is compatible with your
current Android Studio
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
The Android Gradle plugin 3.3.0 requires the Gradle version of 4.10.1 and newer.
Disclaimer: you need to do these steps whenever you create a new project on whatever IDE you use namely, Android Studio, IntelliJ IDEA, and VS Code.

Renderscript error in Android Studio 2.0 stable

I updated Android Studio to 2.0 stable, then I got this error:
Renderscript support mode is not currently supported with renderscript
target 21+
What should i do?
tnx
This has been fixed in gradle-plugin 2.1.0 and Build-Tools 23.0.3.
Use the code below:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
...
}
Renderscript isn't currently supported with Target 21+ so simply change the target to below API 20 and that error will be solved.
replace your code with below code:
renderscriptTargetApi 20
renderscriptSupportModeEnabled true

How do you set APP_PLATFORM in Gradle NDK plug-in in Android Studio?

I'm building an app with an NDK library using Android Studio 1.5.1 and the Gradle experimental plugin 0.4.0.
Even though the Gradle config is set as such (with minSdkVersion.apiLevel = 18), it seems like the NDK library is still compiled for android-21:
compileOptions.with {
sourceCompatibility=JavaVersion.VERSION_1_7
targetCompatibility=JavaVersion.VERSION_1_7
}
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "net.pol_online.hyper"
minSdkVersion.apiLevel = 18 // Android 4.3 Jelly Bean
targetSdkVersion.apiLevel = 23 // Android 6.0 Marshmallow
}
}
Is it because APP_PLATFORM is not automatically set by the Gradle NDK support based on the min SDK version? If so how do you fix this?
You can set this:
android.ndk {
platformVersion = "19"
}
See https://stackoverflow.com/a/33982735/3115956 for details on this. (In practice, I think your library is built targeting android-23, which has the same effect as targeting android-21 - compileSdkVersion is the one that affects it (for both the java and native code, unless the native one is overridden).

Resources