Add Constraint Layout Barriers Missing In Context Menu of Android Android Studio - android

I am currently going through a ConstraintLayout tutorial and stuck in a specific step (https://codelabs.developers.google.com/codelabs/constraint-layout/#10).
The source is here (https://github.com/googlecodelabs/constraint-layout).
Per instructions below, it says to add a vertical barrier but I do not see the add option in the menu. Actually the entire menu options look different. Where is the "Add Vertical barrier" menu?
Right click on ConstraintLayout in the blueprint or the Component
Tree. You will see the Add Vertical barrier and Add Horizontal barrier
options.
I am running Android 2.3.3.
build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.google.googleio"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
}

I am running Android 2.3.3.
I am going to guess that you mean that you are running Android Studio 2.3.3. In that case, there is no such menu. That is added in Android Studio 3.0, available in beta from today.

Add this line to your gradle (Module:app)
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta1'

Related

No ConstraintLayout in Android Studio

I learning on how to build a Responsive UI with ConstraintLayout by following this article. But I can't see ConstraintLayout options in my Android Project.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.tony.chatapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
repositories {
maven {
url 'https://maven.google.com'
}
}
What did I miss here ?
You need to update your Android Studio to 2.2 or above. Constraint layout was introduced in Android Studio 2.2. It is always recommended to use latest version of Android Studio.
ConstraintLayout is available in an API library that's compatible with Android 2.3 (API level 9) and higher. This page provides a guide to building a layout with ConstraintLayout in Android Studio 2.3 or higher.
Build responsive UI with ContraintLayout
As you are using an older version of android studio first upgrade your Android-studio version.

how to use marshmallow in Android studio

I am using Android studio and i want to use Marshmallow API and AppCompatActivity. When I created a new project the build.gradle contained the below lines but I receive error at R class which says not a symbol.
Please let me know how to correct the build.gradle to get the App work.
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.com.myapplication"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
Click on Build->Clean Project and that will perform a gradle clean
Update your Android SDK Manager Install all component of Android 6.0 (API 23)
R file can be erased due to many reasons, try rebuilding your project(which is the most common issue) and other issues may include any syntax error or inappropriate file permissions in work space, the exact error report can help address the issue better.

package name is not determined in android studio

i am using Android studio 1.5. and at when i click run i receive
unable to determine package name
i checked the manifest file and it is as shown in the image below...but i do not know why the activities are marked with red even the app name and the icon
as well.
please let me know how to fix this
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.com.bt_11"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
I followed the same steps as user2121 and eventually tried downgrading to Android Studio 1.4.1. Unlike user2121, I still got an error, however it was different than when on 1.5.1.
AndroidManifest.xml file not found
Upon searching for this new error, I found this StackOverflow answer which solved the problem for me on 1.5.1 as well as 1.4.1.

My codes are highlighted in red, but my code works. How can I fix this?

I'm trying to implement Google Maps in my app, I've already requested the API and already properly put in the API key at the right place, and the map seem to load up without any problems, but sections of codes are highlighted in red. Would appreciate any help! Oh, and I am using android studio.
Also, I've tried it on a test app before this, and it worked fine iirc. Then I deleted that project and all the keys at google's developer console and started new for my main project and this happens. If this info helps in any way.
Here's a screenshot of the code error :
Here's build.gradle if it helps :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "bossharriscorporation.sendmethere"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.8.0'
}
I found the answer. I was careless. Apparently the application name cannot have an exclamation mark in it. I didn't know before. I shall learn more to better myself.

Android missing layout_alignParentStart after upgrade

I upgraded from Android Studio 0.5 to 0.8
now I have heaps of issues, I resolved most of them but now I get this error
Error:(12) No resource identifier found for attribute 'layout_alignParentStart' in package 'android'
I dont know why it does not have layout_alignParentStart anymore?!
am I missing something here?
I had the same issue, my problem was the compileSdkVersion, I changed from 16 to 20 and it works.
I give you my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "mypackage"
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.+'
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:20.+'
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:20.+'
}
Since API level 17, android has some new attributes for RTL layout such as:
layout_alignParentStart
layout_alignParentEnd
layout_alignStart
layout_alignEnd
layout_marginStart
layout_marginEnd
however some devices has special ROM which may not support these attributes and leads exception
Remove all these *Start /*End attributes can fix the issue

Categories

Resources