Failed to run Google I/O 2014 Android app - android

Google has released I/O 2014 android app, since it must be an valuable android app demo, so I decided to download it and tried to debug it. But, unfortunately, while I was trying to run it after compiling, it said "This app won't run unless you update google play services", actually the google play services on my phone(Nexus 5, Kitkat 4.4.4) is already the newest. So, in my perspective, I thought it was related to the server configurations, because the I/O app uses some google services, like google plus, google map, etc. I followed the official instructions, but instantly I stuck at the first step:After I renamed the package name in the manifest file(using Android Studio refactoring feature, it will change the activity names accordingly) and refactored the R class imports in the java classes(refactoring by moving the old generated R.java to the new package, it will rearrange the corresponding “.R” imports in all related classes), the app failed to run and complained as followings:
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.google.samples.apps.iosched/.ui.BrowseSessionsActivity }
Error type 3
Error: Activity class {com.google.samples.apps.iosched/com.google.samples.apps.iosched.ui.BrowseSessionsActivity} does not exist.
My new package name is “com.enlangtech.samples.apps.iosched”. I have tried to build a trial app and I am sure now that the app package name can be different with the package that activity classes belong to. So I can’t understand where is the problem. Any one could help me? Thanks for advance!

I had the same error after renaming/refactoring. What I did was add the applicationId property attribute to my build.gradle file, and set its value to the application package.
Like this:
build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:19.1.+'
compile 'com.google.android.gms:play-services:4.3.23'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
applicationId "packageName"
minSdkVersion 16
targetSdkVersion 19;
}
buildTypes {
release{
runProguard true
proguardFile file('path_to_proguard_file\\proguard-project.txt')
proguardFile getDefaultProguardFile('proguard-android.txt')
}
debug{
runProguard false
}
}
}
androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myfullpackagename"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#drawable/launcher_icon"
android:label="#string/app_name"
android:name="mypackagename">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
<activity
android:name="package.Activity"
android:label="#string/app_name"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="package.SettingsActivity"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE"/>
<action android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".AboutScreen"/>
<service android:name="package.Service"
android:exported="false"/>
<receiver android:name="package.Alarm"/>
<receiver android:name="package.MyBroadcastReceiver">
<intent-filter>
<action android:name="package.MY_BROADCAST_RECEIVER"/>
</intent-filter>
</receiver>
<receiver android:name="package.MyBroadcastReceiver2">
<intent-filter>
<action android:name="package.MY_BROADCAST_RECEIVER_2"/>
</intent-filter>
</receiver>
</application>
</manifest>

Related

Firebase InstanceId: binding to the service failed: Kotlin

App successfully lanches but get this error message in debugging. FirebaseInstanceId: binding to the service failed
App Build Gradle:
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true // enable mun
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Android manifest:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".FilterPage"></activity>
<activity android:name=".filterdashboard" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have added
<uses-permission android:name="android.permission.INTERNET"/>
In my manifest file and got rid of Firebase InstanceId: binding to the service failed. Hope it will help.
I downloaded the newest version of google-service.json (can be done via Firebase Settings). In my case there was a new entry added to oauth_client. After syncing with the file system and rebuilding my app the warning does not seem to appear anymore.
EDIT 20-02-2020: After testing this a bit more it unfortunately doesn't seem to help in the end. In my case the error message only for sure occur when starting the app the first time after an uninstall of the app - in most other cases it does not happen.
Please try to use an actual device. Per my observation, you'll get this kind of error when you use an emulator even though you've already downloaded all the required libraries related to Google Services. I was also able to see other errors from FirebaseInstanceId.
In my case, login to Google Play on emulator (API: R) is fixed the problem. I think it's about Play Services.
Add service tag inside application tag
<application>
....
<activity
....
</activity>
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
Then add a new kotlin file - MyFirebaseMessagingService.kt
import com.google.firebase.messaging.FirebaseMessagingService;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
#Override
public void onNewToken(String s) {
super.onNewToken(s);
System.out.println("NEW_TOKEN :::::::::::::::::::::::::: "+s);
}
}
Uninstall the App manually and reinstall. This will work.

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.

Signed apk has 0 compatibility in google play store

I've been working on a project for some time now and I pretty much finished and am ready to release it to the play store. I was able to deploy my app through debug mode via the USB cable onto my Samsung s4 phone. Strangely, when I generated the signed apk and released it to the play store, I can't download it on my phone... This makes no sense since I was able to use it when I was testing it... I asked my friends and they experienced the same thing. I looked at my developer console and it says my app is compatible with LITERALLY 0 phones in the market... So I looked it up and I thought maybe my manifest is messed up, so here it is (I'm using android studio btw):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="XXXX">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-feature android:name="android.hardware.CAMERA"/>
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:name="android.support.multidex.MultiDexApplication"
>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<activity
android:name="XXXX"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
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="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="#string/app_name" />
<provider android:authorities="com.facebook.app.FacebookContentProviderXXXX"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
</application>
</manifest>
So I see no issues in the manifest (maybe someone can correct me on that) and if there were it wouldn't have ran on my phone when I tested the app.
So I use a lot of external libraries for my app, here is the list:
1) facebook api
2) twitter api
3) snapdragon
4) google play service
I also had to use multidex (as you saw in the manifest) because the code exceeded 64k lines of code. Here's how the build.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "xxxx"
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { java.srcDirs = ['src/main/java', 'libs'] } }
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile('com.twitter.sdk.android:tweet-composer:1.0.2#aar') {
transitive = true;
}
}
I'm totally new with gradle so I'm not sure if it's set up correctly so there maybe issues with the gradle itself or maybe something else. Anyone have any suggestions what I can do?
I changed the camera feature to required false in the manifest and that did the trick. When I uploaded the apk in the developer console it said 8k+ devices supported. Also the manifest was inccorect, when you put the use-features tag make sure to have camera all lowercase not uppercase like I had.

Watch Face is not syncing to wearable

I'm developing a watch face. The project consists of watch face and handheld app to report the mobile battery. There is no actual companion app - the app is even hidden from the drawer.
I'm encountering the issue that when I install the app on the phone the face is not syncing on the watch.
I'm compliant with almost everything I've found on the internet:
The apk is generated by Android Studio - release version, signed, the wear app is in the res/raw folder.
Permissions are the same for mobile and wear app.
The dependencies are set correctly.
APK is installed via ADB, Watch app are force synced ...
It is worth mentioning that the mobile app does not have an activity or something. So there is no way to manually start it.
Is there anything I'm missing. From my perspective there is not reason not to work ...
Mobile Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="name.name" >
<uses-sdk android:minSdkVersion="18"
android:targetSdkVersion="21" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SET_TIME_ZONE"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" >
<!--android:theme="#style/AppTheme" >-->
<service android:name="name.name.BatteryListener"
android:permission="android.permission.BIND_WALLPAPER" >>
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<meta-data android:name="com.google.android.wearable.beta.app"
android:resource="#xml/wearable_app_desc"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Mobile Gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile "com.android.support:support-v4:21.0.2"
compile "com.android.support:support-v13:21.0.2"
compile "com.android.support:cardview-v7:21.0.2"
compile "com.google.android.support:wearable:1.1.+"
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "20"
defaultConfig {
applicationId "name.name"
minSdkVersion 18
targetSdkVersion 21
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
Wear Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="qualiss.qualissfacewatch" >
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="21" />
<uses-feature android:name="android.hardware.type.watch" />
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SET_TIME_ZONE"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault">
<service
android:name="name.name.MyWatchFace"
android:label="Name"
android:permission="android.permission.BIND_WALLPAPER" >
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_square"/>
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_circle" />
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.example.android.wearable.watchface.CONFIG_ANALOG" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="name.name.BatteryActivity">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Wear Gradle:
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
compile 'com.google.android.support:wearable:1.1.+'
compile 'com.google.android.support:wearable:1.1.0'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "20"
defaultConfig {
applicationId "name.name"
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
}
Both Gradle files were closely matched to Android Watch Face sample ... I was just desperate.
Check that you have identical set of permissions in phone and watch manifest files. It was reason for me in same situation.
You have this in your Wear manifest:
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.example.android.wearable.watchface.CONFIG_ANALOG" />
This looks like it is left over from the example code and is likely pointing to an Activity which does not exist in your mobile app. This could very likely cause a problem with deploying the watch face.
Try removing it and see if it helps.
I've removed those 2 from Wear manifest:
< uses-permission android:name="android.permission.SET_TIME_ZONE"/>
< uses-permission android:name="android.permission.BATTERY_STATS"/>
To me it seems like the correct procedure for permissions should not be to have the same in mobile and wear manifest, but to inherit the wear permissions in mobile and not (also) vice versa.
Thanks for the help!
In your mobile gradle... you need to include this...
dependencies {
wearApp project(':Wearable')

android.compileSdkVersion is missing

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.

Categories

Resources