Gradle Sync Fail - android

I get this error when trying to build my app:
Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha1
Required by:
MyApp:app:unspecified
Gradle version:
classpath 'com.android.tools.build:gradle:2.3.0-alpha2'
Android studio version;
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "MyApp"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
}
I tried going to SDK TOOLS and enabling the constraint solver, but I did not help. This happened just today, and have not have had this issue earlier. Any ideas?

Check if you have installed ConstraintLayout. Open SDK Manager and than in SDK Tools tab you can check what version of ConstarintLayout is installed.

Related

My Flutter App is not running after adding cloud_firebase package

Recently I have added firebase to my flutter project. To use firebase database services I have added cloud_firebase package. But after adding this package my app is not running and giving me an exception:
BUILD FAILED in 31s
The plugin cloud_firestore requires a higher Android SDK version.
Fix this issue by adding the following to the file C:\Users\Jaguar\Desktop\AppDevelopment\acadmt\android\app\build.gradle:
android {
defaultConfig {
minSdkVersion 19
}
}
Note that your app won't be available to users running Android SDKs below 19.
Alternatively, try to find a version of this plugin that supports these lower versions of the Android SDK.
Exception: Gradle task assembleDebug failed with exit code 1
The exception message is also suggesting following suggestions:
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="io.flutter.plugins.firebase.firestore" to force usage (may lead to runtime failures)
I have tried the first two suggestions but still, the app is not working.
It will work after changing the minSdkVersion to 21.
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
For the Projects Created After Flutter 2.8 Update
Add this to project_folder/android/local.properties
flutter.minSdkVersion=21
Now update your project_folder/android/app/build.gradle
defaultConfig { minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger() }
Run flutter clean && flutter pub get
Rerun app
Reference: Change Android Minsdkversion in Flutter  –  2 Easy Ways [2022]
Previous Answers are also correct. I just used another approach.
First add flutter.compileSdkVersion=21 in local.properties file.
Then add this code in app\build.gradle
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = '21'
}
After this make sure minSdkVersion is added to defaultConfig inside app\build.gradle
defaultConfig {
applicationId "com.example.test"
minSdkVersion flutterMinSdkVersion.toInteger()
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
You may not apply changes after editing minSdkVersion
to solve this problem:
1-open build.gradle file and edit it:
android {
defaultConfig {
minSdkVersion 19
}
}
then on right side of android studio,make sure to select open for editing in android studio to apply changes and syncing gradle for new changes.
2-make a clean (File>invalidate Caches/Restart)
android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
}
}
Result: Running with sound null safety 💪
This problem is happening because a package that you are using is not compatible with the new version of flutter
Side note -> try not to upgrade flutter during working on an old project to avoid these problems
To solve it in flutter version 3.0.5 and after changing minSdkVersion and compileSdkVersion values place, you need to go to this path in your flutter sdk:
"your_flutter_sdk/packages/flutter_tools/gradle/flutter.gradle"
then update: minSdkVersion = 19 , compileSdkVersion = 31
static int compileSdkVersion = 31 //compile sdk new version
static int minSdkVersion= 19 //min sdk new version
static int targetSdkVersion = 31 //target sdk new version = compile sdk version
in terminal run flutter clean and flutter pub get then run your application
hope I could help.
Try to add these lines to build.gradle file:
defaultConfig {
minSdkVersion 21
compileSdkVersion 33
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Go to this path :
C:\Users\Jaguar\Desktop\AppDevelopment\acadmt\android\app\build.gradle
android {
defaultConfig {
minSdkVersion 19
}
}
change your minSdkVersion to 30
that is:
android {
defaultConfig {
minSdkVersion 30
}
}

Why android studio show error: Error:failed to find target Google Inc.:Google APIs:15?

setting of gradle:
android {
compileSdkVersion 'Google Inc.:Google APIs:15'
buildToolsVersion '25.0.3'
defaultConfig {
//applicationId "jp.osaka"
minSdkVersion 14
targetSdkVersion 15
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 5
versionName "1.5.0.1438"
}
I had install and restart Android Studio 2.3.2 and restart PC, but it still can't resolve error.
Why android studio show error: Error:failed to find target Google Inc.:Google APIs:15 ?
compileSdkVersion is supposed to be an integer. In your case, if you want to compile with the sdk version 15 you should do:
compileSdkVersion 15

AndroidStudio Failed to Sync Gradle project, Failed to find target Google Inc

How can I resolve the Gradle Sync problem?
I installed the missing SDK versions but the error shown again.
Take a look to the screenshots please...
Screenshot 1
Screenshot 2
Thank you in advance.
Your compileSdkVersion must be a number, not a String
Example:
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.yourpackage.yourapp"
minSdkVersion 11
targetSdkVersion 24
versionCode 4
versionName "1.3"
}
...
}
You also need to open up "build.gradle" script and change the classpath to latest gradle repository.... mine is 'com.android.tools.build:gradle:3.0.0-alpha3'
Hope this helps everyone

When I update my Android Support Library to 23.0.1, there is a error that miss library of 22.1.1

Could not resolve all dependencies for configuration ':MaterialLibs:_debugCompile'.
Could not find com.android.support:appcompat-v7:22.1.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.jar
file:/B:/Android/android-sdk-windows/extras/android/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.pom
file:/B:/Android/android-sdk-windows/extras/android/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.jar
file:/B:/Android/android-sdk-windows/extras/google/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.pom
file:/B:/Android/android-sdk-windows/extras/google/m2repository/com/android/support/appcompat-v7/22.1.1/appcompat-v7-22.1.1.jar
Required by:
FamilyHealthTracker:MaterialLibs:unspecified
Could not find com.android.support:cardview-v7:22.1.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/cardview-v7/22.1.1/cardview-v7-22.1.1.pom
https://jcenter.bintray.com/com/android/support/cardview-v7/22.1.1/cardview-v7-22.1.1.jar
file:/B:/Android/android-sdk-windows/extras/android/m2repository/com/android/support/cardview-v7/22.1.1/cardview-v7-22.1.1.pom
file:/B:/Android/android-sdk-windows/extras/android/m2repository/com/android/support/cardview-v7/22.1.1/cardview-v7-22.1.1.jar
file:/B:/Android/android-sdk-windows/extras/google/m2repository/com/android/support/cardview-v7/22.1.1/cardview-v7-22.1.1.pom
file:/B:/Android/android-sdk-windows/extras/google/m2repository/com/android/support/cardview-v7/22.1.1/cardview-v7-22.1.1.jar
Required by:
FamilyHealthTracker:MaterialLibs:unspecified
Please download 'cardview-v7-22.1.1.jar' by SDK Manager:
Download library from this dropbox link
Copy and paste this folder to
your sdk path\extras\android\m2repository\com\android\support
Restart Android Studio and build project.
Thanks it's working
android {
compileSdkVersion 22
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com."
minSdkVersion 15
targetSdkVersion 22
versionCode 3
versionName "1.2"
multiDexEnabled true
}

Android compile project with target="android-19" failed

Masters,
Recently I am trying to build android project with gradle, and since there one API(#JavascriptInterface annotation) I need to use is only up to api level 17, so I changed my targetAPILevel to 19 in project properties. And it works well when I build the project from Eclipse(Right click on project and Run Android Application).
But when I tried to build the project by gradlew in terminal, it seems it never use target level 19 to build the project. Here is part of the build.gradle file as follow:
android {
// target = 'android-19'
compileSdkVersion 19
buildToolsVersion '19.0.1'
}
Can anyone help me what I did wrong in here, please? Thank you very much.
TargetSdkVersion and compileSdkVersion are different parameters.
In eclipse, you set the target in your Manifest, and set the api used to compile with right click -> properties -> Android Manu.
In your build.gradle you should use something like this:
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}

Categories

Resources