Android Studio - Error: Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha1 - android-studio-2.2

Screen Shot #1 - Android Studio Project Gradle Build View
Screen Shot #2 - Android Studio Project Gradle Sync View
Going through the "Android Studio 2.2 Development Essentials book" and following along with the tutorial in chapter 3. Everything was OK until I completed a task in the Development Essentials book (chapter 3, page 24 in book) that said,
As we can see from the component tree hierarchy, the user interface
layout consists of a layout parent with a single child in the form of
a TextView object. If Android Studio has used a RelativeLayout manager
for the project, the first step is to convert it to a
ConstraintLayout. ConstraintLayout is a new and flexible layout
manager that is used in most projects in this book. To achieve this
conversion, right-click on the content_android_sample entry in the
Component Tree and select the Convert RelativeLayout to
ConstraintLayout menu option as shown below:
Upon completion of the above quoted tutorial task (in chapt. 3 of the Development Essentials book), an error was presented that said:
Error: Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha1
Also, a rendering error was listed as well that said:
Rendering Problems The following classes could not be found:
- android.support.constraint.ConstraintLayout (    Add constraint-layout library dependency to the project, Fix Build Path, Edit XML, Create Class)
Any thoughts on how to fix this? Please see screen shots attached (above). I'm new to Android Studio.
Thank you very much for your time.
I am using the following OS and Android Studio version below:
Win7 professional 64 bit OS
Android Studio 2.2
Build# AI-145,3330264, Built on October 6, 2016

You need add check in..
exist a icon with name "SDK Manager" just click
open Settings -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools
And in this dialog add:
ConstraintLayout for Android
Solver for ConstrainLayout
Then, here only you need close and open Android Studio.
Maybe only you can update to:
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'

Or update your dependency to:
compile 'com.android.support.constraint:constraint-layout:latest_version'

This should solve your error. Go to your build.gradle and change your implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta7' to implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta7' or to any latest

Related

Kotlin Multipplatform - can't see Greeting.kt in Android Studio folder tree

I am just starting to learn KMM (I'm an Android java guy right now) and going through the default Greeting version of Hello World that is automatically put into a new application. My environment seems to be working as I was able to run the default app on both Android and iOS emulators.
However I can't see the file Greeting.kt in the Project tree. I can certainly search for it and open it from Find, but when I drill down the tree shared/commonMain/kotlin/com.myapp... it only shows Platform.
I have a screen cap that shows the path of the open Greeting.kt at the top, but not visible in the tree:
(screen cap)
Unfortunately I can't post an image (not enough reputation), but when I open the file Greeting.kt by doing a Find In Project, it shows the path at the top of the screen (My Application > shared > src > commonMain > kotlin > com > example > myapplication > Greeting), but when I manually drill down the Project tree on the left side of Android Studio Greeting.kt does not show up.
I can also find the file in the Mac Finder. My guess a preference in Android Studio is incorrect?
Any ideas on what might be wrong?
Thanks in advance
Turns out it was an official bug. Solution is to upgrade to Beta version of Android Studio (Chipmunk)
I submitted a bug report to Google and they looked into it:
The root cause is that before [Android Studio]Chipmunk the source set
setup was incorrect, so even though it says commonMain in your
screenshot (from #2), if you open the Platform.kt under that source
set, you'll see that it is in fact
shared/src/androidMain/kotlin/com/example/myapplication/Platform.kt.
[Android Studio] Chipmunk fixes this issue.

How to update Gradle plugin in Android Studio

Inside Android Studio I'm getting the error:
Generating signed Bundle requires you
to update the Android Gradle plugin
to version 3.2.0 or higher
If I click "Close this dialog and update the plugin" it goes to another prompt asking whether to update. Clicking "Update" appears to do nothing except close the prompt.
All other similar issues and advice are from a few years ago and the latest version of AndroidStudio has a different interface and have not helped in this situation.
I am running:
Android Studio 3.6.3
Gradle 6.4
UPDATE:
Below is a requested screenshot of the AndroidStudio UI for setting up project structure:
In Android Studio do the following:
1. File -> project structure
2. Select "project" from the left hand side.
3. On the right hand side under "Android Gradle Plugin Version" use the drop-down menu to select the Gradle plugin version you desire.
4. Press "Apply" and then "Ok"
If for some reason you could not do that, you can try:
1. Under "Gradle Scripts" choose "build.gradle(project: ... )".
2. From the right hand side under "dependencies" change the build gradle version to the required or latest one on this line:
3. Do not forget to sync on the top right hand side
In my case I was having the same issue when I after installing it opened Android Studio and tried to Profile or Debug APK. For me the issue was solved when I created a new (empty) project. Then the Android Gradle Plugin updated itself.

Intellij Idea 2017.3 (and Android studio 3.1) project tool window doesn't show visibility icons anymore

After upgrading to Intellij Idea 2017.3 and to Android Studio 3.1 canary 6 I noticed the project tool window doesn't show the little lock icons next to files anymore.
This is very useful to have a bird's eye view on the visibility of each file (public, package protected...).
Is there a setting to bring them back?
Marco, please check this comment on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-172513#comment=27-2150075

Hierarchy Viewer is gone

It used to work well.But recently I upgraded my Android Studio to 2.3 and I find the hierarchy viewer disappears.I can't find it both in the sdk/tools directory and the Android Device Monitor.
Latest build tools (25.3.0) removes hierarchy viewer.
http://tools.android.com/recent/androidsdktoolsrevision2530feb2017
"The Layout Inspector available in Android Studio 2.2 is an early release. It's a work in progress that will supersede the Hierarchy Viewer tool once it is feature complete. For now, it provides a quick solution to inspect the view properties of your layout without leaving the IDE. " I find it in http://tools.android.com/tech-docs/layout-inspector.
According to it the Hierarchy Viewer is removed and we should use the layout inspector instead?
You can find it in the Android Studio with path
Tools > Android > Android Device Monitor > Window > Open perspective > Hierarchy View
You can refer this very detail post for more.

Android Studio can no longer add SDKs, only JDKs. Why?

I've upgraded Android Studio from 0.8.* to 1.0.0 RC2 and finally 1.0. Somewhere between the RC2 and 1.0 Android Studio seems to have lost most of its references to the Android SDK.
Some indicators of this are:
All Android SDK tools have disappeared from the toolbar
No longer possible to attach the debugger or run apps from within Android Studio
In 'Project Structure', the SDKs list shows a list of previously added SDKs but when pressing '+' to add an SDK it only allows me to add JDKs.
In 'Project Structure', the previously added SDKs show "Unknown SDK home path" with a path to the location of the Android SDK. Editing the field with the '...' gives me a "Select Home Directory for Unknown SDK" and pointing to an Android SDK location and pressing OK shows a warning dialog saying "The selected directory is not a valid home for Unknown SDK".
The 'android' facet is an unknown facet type
How do I make Android Studio recognize the Android SDK again?
After a few hours of research (uninstalling and re-installing) I worked out how to fix it but still I don't know how it happened.
These are the steps:
Close your current project
Go to Settings
Click on Plugins
Enable Android Support
Follow the wizard
If you are on Windows, you can right-click the toolbar, and select Customize Menus and Toolbars -> Main Toolbars -> Android.MainToolBarActionGroup. You can also select the SDK Manager and AVD Manager from the Main menu.

Resources