I've installed latest Android Studio and
- I've created new project for sdk 25
- I have sdk 25 installed
I have this issues:
first of all, I don't see Tools > Android > AVD Manager. So I have no idea how can I set up additional AVD
second: I get this error in console
Error:Failed to find target with hash string 'android-26' in: C:\Android
Install missing platform(s) and sync project
Why is it complaining about version 26? I have project with api 25 set up?
This problem seem to emerge because AndroidStudio tries to target the last version of SDK it aware of. There few ways to solve it and #HarryFromMarydelDE Jan 7 at 20:18 presented nice solution in form of youtube video. I'll make this answer verbose and more detailed:
One way to deal it is to install sdk-26. You really may not have Android->AVD Manager menu items under Tools menu. You can find SDK Manager icon just under the Android Studio main menu, or open File->Settings (Ctrl+Alt+S) and go to Appearance&Behavior->System Settings->Android SDK
Other way is to find gradle.build file in YourAppName/app folder, find lines: compileSdkVersion 26 and targetSdkVersion 26 in it and change number into SDKs you already have.
But, if you'll change target sdk from 26 to 25, you may encounter more errors. Particularly, if you checked Back Compatibility box when you created your app in wizard. In this case you'll need to change 'com.android.support:appcompat-v7:26.1.0' string to use sdk 25 version of appcompat-v7:25.1.0 in the same file.
After this, you may encounter one more error:
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (25.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
To resolve it, edit app.iml in YourAppName/app folder: change 27.1.1 numbers to 25.1.0 and hopefully, Gradle will finally build your project.
Related
I don't get any description. I've reinstalled Android Studio, deleted whole android profile and cache but still it did't help.
Edit1 - Note: When new API's are released, the documentation is not always released with it. You need to check their update log to determine that.
Install the Sources of the API you are using.
The documentation will show up afterwards.
Steps:
Tools -> SDK Manager
Check "Show Package Details"
Check the required API Source
Wait for indexing to be finished.
When I faced this issue it was because the compileSdkVersion set in app build.gradle was only installed partially according to the SDK manager.
Installing the SDK for the compileSdkVersion fully fixed the documentation issue on Mac OS AS 4.0.1. This is accomplished by simply checking the checkbox.
To illustrate, on this image the documentation would work with compileSdkVersion set to 26 or 29, but not when set to 28 or 30.
Faced the same issue. Clearing cache doesn't seem to the trick.
The thing here is - Sources for Android 30 is not yet available in SDK Manager. So we need to use android 29 at least for development environment to see the documentation. Go through the following steps :
Download Sources for Android 29
Update the following properties in app/build.gradle file :
compileSdkVersion 29
buildToolsVersion "29.0.2"
targetSdkVersion 29
Let's say you're using API 29 for your current project. You open an older project to see how you did something, which used API 28. Android Studio starts automatically downloading everything you need for the older project to build, including the entire API 28 SDK. Is it possible to prevent that from happening?
Edit the build.gradle with any other text editor, before opening it as a project in Android Studio.
About the same applies for Gradle wrapper versions.
I have a Flutter project in Android Studio. I am planning to migrate to AndroidX. Whenever I do Refactor -> Migrate to AndroidX, Android Studio shows error message:
You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX.
However I have already set the compileSdkVersion 28 in my app/gradle.build file.
Is there anything else I need to do?
I was able to resolve my issue:
Open the Flutter project into Android Studio
Right click on the android directory, click on Flutter -> Open Android module in Android Studio. It asked me to upgrade my gradle plugin.
Then I installed Google Play Services. Tools -> SDK Manager -> SDK Tools and check the Google Play Services.
After the Google Play Services Installed, I did Refactor -> Migrate to AndroidX.
It started working.
Note: Do the refactor from the project window you opened in the step 2.
Here is how I got rid of "compileSdkVersion 28" error. But before I solved it this way, I upgraded Android Studio IDE from 3.4.1 -> 3.5.1. I am not sure if this was really needed. So whatever version of IDE you have, see if you can use following steps to solve it.
Go to "Project Structure" - (2nd icon on left of AVD Manager icon on top right corner of IDE)
On "Project Structure" dialog under left navigation click on Project Settings->Modules
After selecting Modules, on the right pane you should see 3 tabs Sources, Paths, Dependencies
Click on Dependencies, if you are getting compileSdkVersion 28 error the SDK version under Dependencies is pointing to version lower than 28 -> Select 28 or higher
5. Click OK
Now Refactor->Migrate to AndroidX worked for me
In gradle.build (app) add this
compileSdkVersion 28
defaultConfig {
......
minSdkVersion 21
targetSdkVersion 28
......
}
And there are some implementations required to use androidx :-
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
And add these given two lines(below) to gradle.properties:-
android.useAndroidX=true
android.enableJetifier=true
I'm having exact same problem. Been trying to migrate since all the new firebase stuff is forcing it, but the current guides to upgrade are sparse. First I was trying on a backup of my project with a lot of addons and kept getting that error, then I created a brand new flutter project with all the latest (dev channel), followed every step, checked every detail, read every forum, but still getting "You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX."...
Matched the steps from https://androidxhackathon.blogspot.com/2018/05/refactor-to-android-x.html too and can't get it to refactor right.
Even went to File>ProjectStructure>Project SDK and set to Android API 28 Platform.
Anyone know what we might be missing? Did you have any luck Sam?
Click on Invalidate cache/Restart from file option worked for me
Try replacing the default in dependencies {...} in app/build.gradle with this:
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
The replacement is similar to what is posted in the "Not recommended..." section from this link: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility
If you can explain why this works, please add a comment. Thank you!
Go to "Project structure" in the Files menu. Clear out every issue you see there, like
set the android sdk, fix the problems specified
A simple solution.
follow the steps.
Create a new app --> (tick androidX in the window) --> finish
Add some lines in the android --> app --> build.gradle as follow,
update the defaultConfig
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
Go to Refractor --> migrateToAndroidx
Do Flutter clean
Restart
Run
hope it works now ...
I'm starting to program in Java, my goal is to program apps for android.
But Android Studio is giving me such a hard time. I already have some experience with C# and I've programm before with Visual and Unity and never encounter so many errors, theres always something with AS. I'm on Win 7 with Android Studio 3.1.4. Started giving error with adb.exe missing, gradle sync error and then haxm, but i was able to resolve those, but now is giving me error with Render problem failed to find style and Couldn't resolve resource, try the solution of change compileSdkVersion 27 targetSdkVersion 27, but didn't work. I haven't done anything, just start the project and is giving that, I let you with the screenshot, Thanks. This how the error appears
I just resolve it, so leaving this here if anyone encounters these errors. If you just install Android Studio I recommend you to go to file > settings > Android SDK, then tick the box show package details, install Android 8.1 SDK platform 27 and Sources for Android 27. Hit ok, after finish doubleclick on build.gradle module: app, change the values of to these:
compileSdkVersion 27
targetSdkVersion 27
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
The 28 version its giving problems, why? I don't know, but after reading a lot I was able to fix it this way. Especially if you just started with android studio and you installed for the first time.
This is the issue i am getting.
Error not rendering issue
i tried all the options available on the web. it is a new installation of studio 3.1.3 and it is happening for every new project as i did not test with any old project as i do not have one.
steps to recreate is to clean installation of android studio 3.1.3 and create a new project. i tried to create multiple projects but same issue.
i tried all the options available on Android Studio 3.1.3 having issues with Constraint layout link but all are failing.
any one let me a studio version name where i will not get this issue. i just wanted to develop a app. and i am not a andriod developer. so these issues are very annoying for me.
Have the same problem. I think it's from Android SDK Platform 28 so I uninstall it, and use Android SDK Platform 27 and it work for me.
To uninstall : Tools> SDK Manager> System setting> Android SDK> Show package detail(little
box on the right below corner)> Put out the check sign from Android SDK
Platform 28 > apply and try new project.
Note : Sorry for bad English.