Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJonathan Grieve
Treehouse Moderator 91,253 PointsQuick question about Android Preview
I'm determined to get to the bottom of this...
My Android API/SDK has only ever been able to select API level 23. I tried to poke around to see if I could select a new minimum SDK/API level, then I might be able to get rid of some if not all of the rendering problems in Android Preview.
I couldn't. So... I created a new project and I made sure I selected 4.0 as the minimum API level. I expected to be able to select the range of API's in design view. I couldn't. I don't understand.
Can anyone suggest a way I can get to grips with this other than starting the projects again?
6 Answers
Darel Bitsy
6,910 Pointsi think you need to install package : SDK PLATFORM for the android version you want in order to use it, you can download it with android sdk manager .
Darel Bitsy
6,910 PointsDid you download and installed other version of android sdk ? are you using android studio ?
Jonathan Grieve
Treehouse Moderator 91,253 PointsAll I know is I downloaded every package and prerequisite update AS told me to :)
I had an issue downloading the Atom x64 package but was able to resolve that. I've been at the program for hours.
Darel Bitsy
6,910 PointsSuper, glad to help :)
Jonathan Grieve
Treehouse Moderator 91,253 PointsIt has helped to a degree but I'm still lost in rendering problems and can pick down to API level 21. I think in this case though I'll just keep restarting the project until I get enough experience and knowhow to deal with them :)
Darel Bitsy
6,910 Pointsif you're using eclipse than try to check for update if you're using android studio same thing, and you can clear Invalidate Caches/Restart in Android Studio, it's help a lot if you have issue with your IDE
Jonathan Grieve
Treehouse Moderator 91,253 PointsDo you think Rendering problems could also be caused by a case of trying to use components used for relative layout but you're actually in component layout?
I've started the "Story app" for the 4th time yesterday and I'm finally moving forward with it. I found myself having to choose the right "activities" when creating new classes or creating projects. When using relative layouts a lot of problems seemed to disappear. It helps, of course I have all the API's now but there are so many differences to be aware of because the Android courses are 2 or 3 years old now. :-)
Darel Bitsy
6,910 PointsAlso try to check your build. grade file to check if all dependencies are set up. And the rendering can be a problem with your theme because if the theme you are using is not supported with your View then it will show rendering problem
Jonathan Grieve
Treehouse Moderator 91,253 PointsHaving a look at the file now :)
At least i know now if i have a rendering problem I can simply switch the theme back. Too many times in my earliest days i've ended up getting lost in rendering problems and errors in my Java classes I've had no idea how to fix.
The automatic build passed off okay.
This is the contents of my build.gradle gile
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "uk.co.jonniegrieve.interactivestory"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
testCompile 'junit:junit:4.12'
}
Darel Bitsy
6,910 PointsYour minimum SDK is 14 that mean that you can't have access to some of the features available after 14 Api, but your build file looks good for me, can you post the screenshot of the error you are getting?
Jonathan Grieve
Treehouse Moderator 91,253 PointsJonathan Grieve
Treehouse Moderator 91,253 PointsI'll have a look next time I fire the laptop up :)
Jonathan Grieve
Treehouse Moderator 91,253 PointsJonathan Grieve
Treehouse Moderator 91,253 PointsHi Darel,
I think I may have worked it out. I went into SDK manager and SDK Tools tab and it showed that only Android 6.0 Marshmallow was installed. I'm downloading all the ones available now. Hopefully that means if I get rendering problems now I'll be able to select the appropriate API to continue the project I'm working on.