In android studio, i have create new project that run on 2.2(that shows 100% compatibility). The project is about calculation. I have installed on my phone(lollipop), and the app is working properly. But, I tried to install in my friends kitkat phone, the app is installed but, When i open the app, that shows Unfortunately the app has stopped. So, I need a help. What I have to do?
Thank You.
May be you set Minimum SDK at Lollipop check it out in build.gradle file.
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.communitynow.communitynow"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
and add
compile 'com.android.support:multidex:1.0.0'
in gradle file
Here in defaultConig{} minSdkVersion should be 15 or according to your minimum android run requirement.
You need to create a kit kat emulator to run the app on then check the log cat to see what the error is.
Related
when I install my apk in devices with android 11, I get parsing error, but in another devices with lower android version, I have not this problem. how I can solve it?
my apk is very simple, it is just a web view with fcm packages and have not any special permission in manifest file.
Open your build.gradle file and you will see something like this
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.yourapp"
minSdkVersion 19
targetSdkVersion 30
versionCode 11
Now you have to change the targetSdkVersion to 30 or above (only if possible).
Recompile and Install, I should work by now.
Still if it didn't work, include the error log in your question.
everyone!
I'm new to android programming, so simple things sometimes become a problem.
I have my application. It should work on devices with Android 5 and higher.
The question is what is proper strategy of sdkVersion defining?
What I mean.
For example, I need to acheive permision to use bluetooth.
If my target sdkVersion is 7 and minimum sdkVersion is 5 I should ask permission in manifest file and then acheive it in runtime. Like this
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
...
}
But if my target sdkVersion is 5 even Build.VERSION_CODES.M cannot be resolved.
So the question is : what is proper approach to choose sdkVersion? Where can I read about it?
I read here https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#target
but I didn't get what is best practice. So please share your experience.
Read this article from Ian Lake: Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion
compileSdkVersion:
compileSdkVersion is your way to tell Gradle what version of the
Android SDK to compile your app with. Using the new Android SDK is a
requirement to use any of the new APIs added in that level.
minSdkVersion:
If compileSdkVersion sets the newest APIs available to you,
minSdkVersion is the lower bound for your app. The minSdkVersion is
one of the signals the Google Play Store uses to determine which of a
user’s devices an app can be installed on.
targetSdkVersion:
The most interesting of the three, however, is targetSdkVersion.
targetSdkVersion is the main way Android provides forward
compatibility by not applying behavior changes unless the
targetSdkVersion is updated. This allows you to use new APIs (as you
did update your compileSdkVersion right?) prior to working through the
behavior changes.
Ideally, the relationship would look more like this in the steady state:
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion (latest SDK)
I suppose you are using Android Studio and build.gradle. If not, I recommend you to get it. All of the following is relevant for Android Studio and gradle build system.
Your main mistake is that SDK version in build.gradle of app module is not the same as Android Version. Here is the list of Platform Codenames, Versions, API Levels. What you need for SDK version is number in API level column of first table.
This is how android section of build.gradle for app targeting Android 5.0 and newer should look like.
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "net.eraga.myobjectives"
minSdkVersion 21
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'
}
}
}
Read more about targetSdkVersion, minSdkVersion and compileSdkVersion here.
In this case, your minSdkVersion should be 21 (android 5.0) and targetSdkVersion along with compileSdkVersionshould be 25 (android 7.1).
so i reinstalled linux on my computer and after i reinstalled android studio i tried getting an app that i wrote on to my phone which previously had not been a problem. The App ist targeted at devices with API 16 or higher but apparently Android Studio now features something called N preview which does not let me run anything on my phone. specifically when i hit the run button it tells me that
minSdk(API 23, N) != device Sdk(API 22)
i know this seems as though the target API isnt set correctly but when i started the project i set it to 16. Now how do i get around this? Also whats the cleanest way to change the target API on a project? Do i just change the build gradle?
Thanks a lot!
app gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-N'
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.josias.myapplication"
minSdkVersion 16
targetSdkVersion 'N'
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.+'}
Change
compileSdkVersion 'android-N' to compileSdkVersion 22 and targetSdkVersion 'N' to targetSdkVersion 22
The same happened to me on Android Studio, so I could not start a new emulator.
I had to:
Gradle Scripts -> build.gradle (module:app) -> minSdkVersion 14
(update "minSdkVersion" value to "14".
Now I am able to start a new emulator.
See the explain of CommonsWare. The key point is a preview version, so
older level device was prevented to install app anyway when using N compileSdkVersion.
This wortk for me in Android Studio: hold ctl+alt+shift press 'S', This will open project structure. Click on the tab 'Flavors', check in min sdk version if appear a version of your device sdk if you see select it and click 'OK', but if you didn't see a option for your sdk device click on cancel. Go to build.gradle(app) file and type in the min sdk version the version of your sdk device(android studio will recomend you to intall the version sdk). After that hold ctl+alt+shift press 'S' and the version sdk min will be there, just select it and click 'ok'. :)
check your build.gradle file to ensure the proper min sdk is set...android studio overrides the manifest with the build.gradle
I renctly encountered this problem, and this is very strange, on the other thread there's people suggest you should change you usb setting to "MTP/FTP" or something, this doesnt make sense and dont work out on my case.
After search some example case in this problem, I found that most of people have this problem when minSDK/'targetSDK'/'compileSdkVersion' is not a int but a letter.
I changed my MNC/N' to 23, andbuild - clean build`, problem solved.
hope it can help someone.
Change the minSdkVersion to your target device sdkVersion in build.gradle(Module:app)file will be appear on left side in Gradle Scripts.. Ex: minSdkVersion 24 //change the version value to ur target device value(like 23 or 22 or 21 or etc)
According to your configuration you have to change the minSdkVersion 23 to minSdkVersion 22, becoz your target device at API LEVEL 1
you can do a thing just open the sdk manager since i had one and just install ,the ÄNDROID N (API 23 N PREVIEW PACKAGES) give it a try instead of changing the gradle files
Changing the minSdkVersion may not always help. Check your SDK Manager, as already suggested, and make sure that you have the necessary versions installed as well (I had changed mine in Gradle, but it only made things worse on my end).
I am trying to deploy a version 1.1 update to my android apk of my worklight app. However when I try to update the versionName on my Manifest and build the project, it automatically gets updated back to 1.0 (updated to 1.1) and versionCode is also auto incremented. I do not want this to happen and I want an updated version 1.1 to be built. Any help here please ?
example entry below... the versionCode got updated to 13 from 12.
android:versionCode="13" android:versionName="1.0"
I use eclipse/worklight and not Android Studio. This auto update is still kind of confusing me.
If you are using Android Studio settings in your app build.gradle will override your app manifest.
Make your changes in build.gradle file
defaultConfig {
applicationId "com.abc.yourapp"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.1"
}
Try this code to change version
here is link
if it is not working for you then clean project and then rebuild it
I am about to release my first app and targeted lollipop when writing it in the hope that the uptake would of been greater by the time I was done. As well all know, it is still awful.
In my build.gradle I have this line:
android {
signingConfigs {
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xxx.xxxx.toolbox"
minSdkVersion 21
targetSdkVersion 21
versionCode 7
versionName "1.15"
}
If I change the min SDK version to 19, the app will try and install on a device running API level 19. It crashes, but does not give me any feedback as to why (I have obviously used some methods from higher APIs). Is there any way to quickly figure out which methods I have used that need to be changed?
thanks,
Matt
If you set minSdkVersion to some version and recompile your application, Lint should automatically mark all instances where you use higher API as errors. That is, unless you annotate it with #TargetApi.
Also, if your application crashes, check LogCat. There will be an exception describing what went wrong and where.