android.compileSdkVersion is missing - android

Im using AndroidStudio and Im trying to put some ads on my app, according to the setting up google play API - https://developer.android.com/google/play-services/setup.html
Adter i sync the project with the grandle files i get this error:
Error:Failed to find: com.google.android.gms:play-services:5.0.77
Install Repository and sync project<br>Open File<br>Open in Project Structure dialog
This is my gradle.build:
apply plugin: 'com.android.application'
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.pachu.fartsounds"
minSdkVersion 8
targetSdkVersion 19
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:19.+'
compile 'com.google.android.gms:play-services:5.0.77'
}
My Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pachu.fartsounds">
<application
android:allowBackup="true"
android:icon="#drawable/fart_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".FartActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Any ideas? Thanks !

You are missing critical components of your manifest. The SDK error you are receiving is because the compiler doesn't know at what SDK level to compile your app - you're missing <uses-sdk.
And while we're at it, you're also missing your package name, version name, and version code. These are all critical components to your app. Here's an example of a well-formed manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.exampleapp"
android:versionCode="2"
android:versionName="v0.2-Alpha" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.GET_TASKS" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.exampleapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:enabled="true" android:name="com.example.exampleapp.MyService" />
</application>
</manifest>
Notice at the very top: the sections that read package, android:versionCode, and android:versionName. And also, below those, the entire section that starts with <uses-sdk... These are all required.

Add this to your build.gradle:
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
}

I had the same issue and fixed it next way:
in build.gradle file of module (usually in app, not in root project directory) I set
android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
// your application version and id settings
}
where 19 - is and SDK I have completely loaded in Android SDK Manager
(same values checked in Studio module settings, Properties and Flavors tabs).
So, may be your problem is a cause of minSdkVersion 8 value, when you don't have 8 API installed.

I had the same error.
In my case the package 'Extras\Google Repository' was not installed.
So after installing it in SDK Manager the problem had gone.

Related

ActionBar is not being displayed anymore after migration from Eclipse to Android Studio

I recently tried to edit my 4 year old android application in the recently appeared Android Studio 2.3.1.
After importing the code I can launch it on my mobile phone. However the action bar seems to have disappeared. What has gone wrong?
How can I tell android to display the action bar?
I have implemented the action bar activity like this:
public class MainActivity extends ActionBarActivity
My build.gradle looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "de.my.app"
minSdkVersion 8
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:18.0.0'
}
I also tried to replace the compile command with something newer one:
compile 'com.android.support:appcompat-v7:25.3.1'
but already the syncing in android studio fails like this, throwing the following error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com.android.support:appcompat-v7:25.3.1] /home/user/.android/build-cache/815cafa5312f1d889eb1134b2184a62b3f88d8a3/output/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
I haven't done much android coding in the last 4 years so I assume the ActionBar stuff has changed profoundly but shouldn't there be a way to compile the old code as it is using android studio?
Edit:
This is the manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.myApp.myAppDemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/icon_app"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="de.myApp.myAppDemo.Splash"
android:label="#string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="de.myApp.myAppDemo.MainActivity"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/Theme.AppCompat.Light">
<intent-filter>
<action android:name="de.myApp.myAppDemo.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="de.myApp.myAppDemo.PropertiesAssign"
android:label="#string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="de.myApp.myAppDemo.PROPERTIESASSIGN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="de.myApp.myAppDemo.PropertiesView"
android:label="#string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="de.myApp.myAppDemo.PROPERTIESVIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Meanwhile I got at least the ActionBar to be displayed. However I had to increase the MinSDK and targetSdkVersion / compileSdkVersion bigly: From 8,17 to 15,23. Moreover I had to look in the SDK-Manager to see which exact version of Android Support Library was installed on my system (23.2.0) and adapt the corresponding line in build.gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23 //->modified
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "de.Geo.geodraw"
minSdkVersion 15 //->modified
targetSdkVersion 23 //->modified
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile "com.android.support:appcompat-v7:23.2.0" //->modified
}
Not sure whether it was relevant or necessary but following this page I also added
allprojects {
repositories {
jcenter()
maven { //->modified
url "https://maven.google.com" //->modified
} //->modified
}
}
in another build.gradle file.
If there is another solution without drastically changing minSdk and targetSdk I will accept that answer.

MapBox SDK not working android

I just started to use the MapBox SDK but its not working I was following the steps on the documentation but Im not getting any classes from their SDK here is my code:
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.mapp.hello"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.0-beta.2#aar'){
transitive=true
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.mapp.hello"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService"/>
</application>
</manifest>
The com.mapbox.mapboxsdk.telemetry.TelemetryService is shown in red and I cannot import the MapboxAccountManager
I know it's an old question, but I just had the same error while trying to update from Mapbox 4.x to 5.x and it turns out you have to change:
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService"/>
to
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService" />
Update:
Turns out in the latest version (5.x) you don't have to declare it in the Manifest at all, as Mapbox now makes use of Manifest merge feature.
I dont know how but the app was getting run even though gradle build was stopped because of lint, I just stopped lint from stopping the build process now everything is working :)

Play store says my app is supported by 0 devices

I have recently finished building my first android app. I published it to the store today but it says it supports 0 devices. Here is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.guessthepicturespazam.guessit" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="נחש את המילה"
android:theme="#style/Theme.AppCompat.NoActionBar" >
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="נחש את המילה"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".GameActivity"
android:configChanges="orientation"
android:label="#string/title_activity_game"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Splash"
android:configChanges="orientation"
android:label="נחש את המילה"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".StoreActivity"
android:label="#string/title_activity_store" >
</activity>
<activity
android:name=".GameOverActivity"
android:label="#string/title_activity_game_over" >
</activity>
</application>
<supports-screens
android:anyDensity="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:resizeable="true" />
</manifest>
This is my build.grade file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.GuessTheWordZahal.guessit"
minSdkVersion 10
targetSdkVersion 23
versionCode 2
versionName "1.0.1"
}
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'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.google.android.gms:play-services-ads:7.8.0'
}
I tried looking this problem up online but I couldn't find a problem similar to mine. Most apps have no supported devices because they use features that are only available in some or in no devices. I just can't figure out what's wrong in mine. I've actually tested this app on my samsung galaxy and it worked fine.
You need to provide supported sdkVersion
<uses-sdk
android:minSdkVersion="minimum(e.g "8")"
android:targetSdkVersion="maximum(e.g "22")" />
if you are using Eclipse then mention your minSdkVersion & maxSdkVersion in your manifest file and if you are using Android Studio then mention these in build.gradle file.
For Eclipse
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.guessthepicturespazam.guessit"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="21"/>
.......................
</manifest>
For Android Studio
edit your build.gradle file like as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.guessthepicturespazam.guessit"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Note: Version name and Version code is important if you want to update your application in future.
Your manifest is incorrect.
<supports-screens>
is currently placed in application tag but should be moved up, to manifest tag.
Check out manifest structure https://developer.android.com/guide/topics/manifest/manifest-intro.html#filestruct
I suppose play-store parser couldn't find supports-screens information and decided that there is no screen supported. Please, correct manifest and let us know. Very interesting issue.

Android app showing incompatible after publishing

I have just tried to publish my first app but when it finally went through it was shown as being incompatible to multiple devices, I have been searching and every fix that I have come across has done nothing for me. Any suggestions?
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.customledsupply.ledaudit" >
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/cls"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainPage"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".OldLocation"
android:label="#string/title_activity_old_location" >
</activity>
<activity
android:name=".NewLocation"
android:label="#string/title_activity_new_location" >
</activity>
<activity
android:name=".RoomDescription"
android:label="#string/title_activity_room_description" >
</activity>
<activity
android:name=".FixtureDescription"
android:label="#string/title_activity_fixture_description" >
</activity>
<activity
android:name=".RoomList"
android:label="#string/title_activity_room_list" >
</activity>
<activity
android:name=".Summary"
android:label="#string/title_activity_summary" >
</activity>
</application>
</manifest>
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.customledsupply.ledaudit"
minSdkVersion 19
targetSdkVersion 22
versionCode 2
versionName "2.0"
}
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "CLS"
keyAlias "Custom LED Supply"
keyPassword "CLS"
}
}
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.1'
compile 'io.realm:realm-android:0.82.0'
}
Most probably, the potential cause is the following:
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
If any device doesn't have this feature, it wont even show it on the play store for them and will be in your list of incompatible devices. If you want to make it optional, use android:required="false" instead. By doing thing, you might be able to get around the issue.
Otherwise if you give examples of the incompatible devices, we might be able to narrow down the issue more. Hope it helps.
In your AppManifest.xml, you added a feature that is not be supported by all devices which is android:name="android.hardware.camera2". It only supports API 21+. However, you can set the required attribute to false, but that will cause issues for your app.
Reference Link: https://developer.android.com/reference/android/hardware/camera2/package-summary.html

Android: Cannot resolve symbol ActionBarActivity

I'm getting the error "Cannot resolve the symbol ActionBarActivity" when I try to import it (import android.support.v7.app.ActionBarActivity;).
I've already read some questions ActionBarActivity cannot resolve a symbol and Import Google Play Services library in Android Studio about it and i've tried the solution described there but I couldn't fix my problem.
I tried to change the targetSdK to one lower and then I wrote back that that I had before but it didn't resolve.
I'm using Android Studio version 1.0.2.
My build.grad file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.android.asminhasdespesas"
minSdkVersion 13
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.0.3'
}
My Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.asminhasdespesas" >
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="21"></uses-sdk>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Do you have any possible resolution to fix this issue since I think this shouldn't happen with this Android Studio version. Thanks.
Looks like you're missing this import in the activity:
import android.support.v7.app.ActionBarActivity;
You can fix this by using ctrl + alt + o. A project rebuild might also do the trick.
I tried to refresh Gradle and it seemed to work! Maybe some instant problem with android studio and gradle synchronization!

Categories

Resources