How to change the target version of android in android studio - android

I import an eclipse project into my android studio. The original project's target is android-14, but my studio's mimimum API version is 21. And I don't want to download the API 14, how should solve my problem?

You only must have downloaded the SDK configured as compileSdkVersion. Your SDK configured as minSdkVersion can be a lower version such as API 14.
In the Android Studio the configuration is realized in build.grade file. For example:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(":lib")
compile 'com.android.support:appcompat-v7:19.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

you have to add dependencies in build.gradle to use
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"

Related

application cannot be installed on API 21

I just made an application using Android Studio 3.6, I tested using API 29, the application can be installed, but when I ask my friend to test on his device (Android 6.0) the application is not installed, so my application can only be installed on Android 7.0 and above, I want old Android users to be able to use my application. This is build.gradle that I use
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 21
targetSdkVersion 29
versionCode 10
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
...
}
I have tried to downgrade the target SDK but it still cannot be installed

New Android Studio don't let me build project with API 23

Today, I upgraded latest Android Studio latest Version and build the project. And the problem is New Android Studio don't let me compile project with SDK 23...
I cannot build with SDK 25 because it is crush on lower SDK version and only work with some upper SDK. Please suggest how could I solve this problem.
Error:The SDK Build Tools revision (23.0.1) is too low for project ':app'. Minimum required is 25.0.0
Here is my gradle code,
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.app.androidlivetv"
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
onesignal_app_id: "90582504-49da-44c1-8a3c-800ca73877af",
onesignal_google_project_number: "267076126070"]
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
}
dependencies {
compile files('libs/picasso-2.4.0.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'it.neokree:MaterialTabs:0.11'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.devbrackets.android:exomedia:2.5.5'
compile 'com.google.android.exoplayer:exoplayer:r1.5.8'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:multidex:1.0.1'
}
Just change the target sdk to 23 and compile with 25 it shouldn't crash..
You have to set in you gradle
buildToolsVersion "25.0.2"
And you have to upgrade build tools version as well.
Sample that should compile for min version 23 (
android {
compileSdkVersion 23
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"

"Error:(2) Error retrieving parent for item No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'

I have a problem with Gradle !!
It keeps showing me errors , can some one help me to resolve this problem
Note: It's my first time to install android studio
Try using this:
compile 'com.android.support:appcompat-v7:24.1.0'
Use latest support library and change your target and compile sdk also
compileSdkVersion 24
buildToolsVersion "24.0.1"
targetSdkVersion 24
Try it
compile "com.android.support:appcompat-v7:23.0.1"
and you can change targetSdkVersion 23
Please use my project gradle values and also update sdk libraries:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
multiDexEnabled true
applicationId "com.example.student" //change as your package name
minSdkVersion 16
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
}
Try to match all versions:
compileSdkVersion 23
buildToolsVersion '23.0.0'
targetSdkVersion 23
Add Following dependencies:
compile 'com.android.support:appcompat-v7:23.0.0'
Make sure you use latest version of Sdk:
how to update sdk
The problem is you're using
compile 'com.android.support:appcompat-v7:19.+'
which gives you all possibilities of Android 4.4.2 Kitkat API 19 and older.
In your project you're trying to use Material Themes which belongs to newer version, I mean com.android.support:appcompat:$version, where version > 21.
Material Design was introduced with Android 5.1 Lollipop API 21
I higly reccomend you to change your build.gradle file to:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
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:appcompat-v7:24.2.1"
}
but of course changing appcompat library to version :
com.android.support:appcompat-v7:23.0.1"
would be enough ;-)
Hope it would help

Emulators are not showing in Android Studio

In Android Studio the Emulators are not showing . I tried that disabling ADB Integration. but it is not working for me.
Please give me solution for this problem.
Maybe your project is not compatible (API version) with the target emulator. Check build.gradle file if the targetSDK and minimumSdk version is lower or equal to the sdk version of your Emulator.
Be sure that your compiledSdkVersion matches minSdkVersion and supported by targetSdkVersion. For example:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "zeta.sqlitetest3"
minSdkVersion 16
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}

Error in xml After Adding Google Map Activity

I am getting following error :
Error:(1) Error retrieving parent for item: No resource found that
matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'. in values
v-23.xml
Here is my gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.ashwin_bhoyar.techtt"
minSdkVersion 15
targetSdkVersion 21
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:24.0.0-alpha1'
compile 'com.google.android.gms:play-services:8.4.0'
}
No resource found that matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'
You should call API Level 23
compileSdkVersion 23
buildToolsVersion "23.1.0"
defaultConfig {
applicationId "com.example.ashwin_bhoyar.techtt"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
And use
compile 'com.android.support:appcompat-v7:23.1.0'
Please add this to your gradle.
compile 'com.android.support:appcompat-v7:23.1.0'
Hope this would work
I edited your gradle code ............try to this,I hope's its works
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.ashwin_bhoyar.techtt"
minSdkVersion 15
targetSdkVersion 21
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:21.1.2'
compile 'com.google.android.gms:play-services:8.4.0'
}
Your compile SDK version must match the support library's major version.
Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 21 of the Android SDK by switching to the latest support library v21.
Please check The highlighted Part Of image

Categories

Resources