uses-sdk is missing in manifest - android

i am following the Training section of developer.android.com where i can read :
One of the most important elements your manifest should include is the
element.
But, the automaticaly generated manifest i have is :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.david.myapplication" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.david.myapplication.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>
Where i can't see any .
Must i consider it as normal behaviour ? Must i add this by myself ?
May be usefull : i am using AndroidStudio instead of Eclipse/ADT

Android Studio uses the newer Gradle-based build system. Its manifest merger creates the actual manifest for you, based on the information in the AndroidManifest.xml files and build.gradle files.
In particular, the uses-sdk information is usually derived from build.gradle.

For android studio, the compile sdk version is in the build.gradle. like this:
defaultConfig {
applicationId "com.eyespage.sdk.accounts"
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
so you don't have to include it in manifest

Related

AAPT2 error: check logs for details after Android Studio upgrade

I've upgraded my Android Studio, since this I get an error "AAPT2 error: check logs for details"
In the internet I didn't find a solution.
My androidmanifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ch.workouttracker"
android:versionCode="1"
android:versionName="1.0" >
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".TrackActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ProfileActivity"
android:label="#string/title_activity_profile" >
</activity>
<activity
android:name=".TrackCardioActivity"
android:label="#string/title_activity_track_cardio">
</activity>
<activity
android:name=".TrackWorkoutActivity"
android:label="#string/title_activity_track_workout" >
</activity>
<activity
android:name=".LogoutActivity"
android:label="#string/title_activity_logout">
</activity>
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_settings" >
</activity>
<activity
android:name=".DashbordActivity"
android:label="#string/title_activity_dashboard" >
</activity>
<activity
android:name=".CreatePlanActivity"
android:label="#string/title_activity_create_plan" >
</activity>
<activity
android:name=".CreateExerciseActivity"
android:label="#string/title_activity_create_exercise" >
</activity>
<activity
android:name=".EditActivity"
android:label="#string/title_activity_edit" >
</activity>
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login" >
</activity>
<activity
android:name=".WorkoutDetailActivity"
android:label="#string/title_activity_workout_detail" >
</activity>
<activity
android:name=".PlanDetailActivity"
android:label="#string/title_activity_plan_detail" >
</activity>
<activity android:name=".CalendarActivity" >
</activity>
<activity android:name=".EditExerciseActivity">
</activity>
</application>
</manifest>
I tried a reinstall and downgrad of the android sdk. I deleted .gradle. I set the property android.enableAapt2=false in gradle.properties
What else can I try? What other information do you need?
I ran into this problem a while ago, after updating my Android Studio to the latest version. After searching for a long time, this answer was my savior.
As this answer suggests, the problem might be messed up XML files in your project. You can look for the messed up part by yourself, or run the assembleDebug command in your terminal (like this), which can find the exact line that should be fixed.
Based on Google's documentation:
If you are experiencing issues while using AAPT2, you can disable it by setting android.enableAapt2=false in your gradle.properties file and restarting the Gradle daemon by running ./gradlew --stop from the command line.
When you set the android.enableAapt2=false you have to restart the Gradle daemon.
You should restart the Daemon and then Click on
Also ensure that you are using latest buildToolsVersion
I also got same problem.By changing build.gradle file like as follows i resolved that.
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
I also solved the issue as per Paila Khagesh suggestion. I had
compileSdkVersion 26
and
targetSdkVersion 25
After changing targetSdkVersion to 26 and sync gradle error was gone.
Many ways to create this problem! Here is one that we created and had no idea why it happened. By accident we pasted our favorite color.xml file int the styles.xml folder. We had no warning when we did the paste and not while continuing to design the app. BUT when we closed the app and it needed to rebuild when loaded the fun began. We guess the solution might be to build before you close the app or review all your XML files before you build or close better yet LOOK WHERE YOU ARE PASTING

Problema updating and uploading my apk

Hi guys this is the first update I make to my app... I was reading and noticed that I need to change the versionCode and versionNameof my app in the manifest.xml, I did this and click on Build-> Generate Signed APK then in the developer console select my app and in the left menu click on APK then upload new APK and select my new generated APK but I keep getting the same error:
Upload error You must use another version code for your APK because
you already have a file with the version code 1.
BUT I don't know why I'm getting this error this is my manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ve.net.gorydev.bachaqueofamilia"
android:versionCode="2"
android:versionName="1.1">
<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>
</application>
</manifest>
what should I change?? remember this is my first update
The versionCode and versionName are also defined in your app/build.gradle; define them there and you should have no problems.
android {
defaultConfig{
versionCode 2
versionName "1.1"
}
}

How to solve Android Error type 3?

Below manifest formation I am using into my project but whenever I am trying to run my emulator, I am getting below mentioned error. please give me a exact solution for solving the error.
Tools informations
Android studio
Nexus S API 22 (android 5.1.1)
My Manifest file formate
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.info.androidapp" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="app"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<!-- Splash activity -->
<activity
android:name=".SplashActivity"
android:label="app"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Login activity -->
<activity
android:name=".LoginActivity"
android:label="app"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</activity>
<!-- List activity -->
<activity
android:name=".listActivity"
android:label="app"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</activity>
</application>
</manifest>
My Error :
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.info.androidapp/.SplashActivity }
Error type 3
Error: Activity class {com.example.info.androidapp/com.example.info.androidapp.SplashActivity} does not exist.
NOTE : Sometimes I am facing Unfortunately, the process com.android.phone has stopped alert into emulator!
After searching it for so long what helped me was.
1) File -> Sync Project with Gradle Files.
Or
This helped me too.
2) Uninstalling the previous installed application from emulator/mobile and re-run it and install it again.
Uninstall your app via 'adb' in the terminal: adb uninstall com.example.yourapp
I had to uninstall the app for all users.
If you have multiple users (e.g. a kids mode) on your device, uninstalling the app from homescreen only removes the app form the current user.
Go to Settings -> Apps -> (Your App) -> Open Popup Menu (by clicking on the three dots in top right corner) -> Uninstall for all Users
In build.gradle, the line:
apply plugin: 'android-library'
needs changed to:
apply plugin: 'android'
Edit:
Solution is deprecated. Please use this:
apply plugin: 'com.android.application'
try this
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.info.androidapp" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="app"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".SplashActivity"
android:label="app"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Login activity -->
<activity
android:name=".LoginActivity"
android:label="app"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</activity>
<activity
android:name=".listActivity"
android:label="app"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</activity>
</application>
</manifest>
your Main Launcher activity always should be only ONE Activity.
Include the applicationId configuration in build.gradle if it doesn't already exist.
android {
compileSdkVersion 18
buildToolsVersion '19.0.0'
defaultConfig {
applicationId 'com.myapp.app'
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
The solution to my problem was to uninstall an app from the app (Settings) folder in android because the app was just disabled.
I thing other solutoions will work fine for few user in my case i am using android 9 and i have multi user option enabled for system, it automatically install application for guest user, so goto
Settings>Apps>Concern App
And you will see uninstall for all user option at the top Option Menu. Uninstall and everything will work fine.
in my case this error sparsely appears in one project only and I can resolve it only uninstalling the app. the simplest way is to use Gradle:
ProjName->Tasks->install->uninstallAll
The Uninstall your app via 'adb' in the terminal: adb uninstall com.example.yourapp
worked fine for me

unable to change version in androidmanifest.xml

I am creating any android application and the want to upload in play store.My problem is the that when i try to change the version i am AndroidMainfest.xml and try to build the apk then version of application change to previous one.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.menubar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<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>
in Android Studio just change Version value in Build.gradle this will override values with manifest.xml
defaultConfig {
applicationId "YourID"
.......
versionCode 001
versionName '0.0.1'
}
If you are using Eclipse then just change version in manifest.xml and clean and built new apk. I am damn sure this'll change your app version.
android:versionCode="1.1"
android:versionName="1.0.1"
If you are using Android Studio, you must change the App Version in gradle.
When you build your application, Gradle replace values from manifest.
If you are using eclipse, check if you do not change AndroidManifest.xml placed on build folder.
If this does not work, try to project > clean, make changes and rebuild.

Android Studio - Gradle Manifest Merging Failed

I am building a demo app using actionbar sherlock in android studio and i was facing problem , mentioned in following link :-
Previous Problem
now after following the replies posted on above link i did some changes and now i am facing this
Gradle: Execution failed for task ':SherlockTest:processDebugManifest'.
> Manifest merging failed. See console for more info.
my application manifest file is :-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sherlocktest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.sherlocktest.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>
and actionbar sherlock manifest file is :-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="440"
android:versionName="4.4.0"
package="com.actionbarsherlock">
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16"/>
<application/>
</manifest>
i am not able to figure out what is the problem here, please help
Make sure that in all your build.gradle scripts the minSdkVersion and targetSdkVersion correspond to those you have in your manifests:
android {
defaultConfig {
minSdkVersion 10
targetSdkVersion 16
}
}
This worked for me, I hope it does the trick for you, cheers.
For what I can see, if you have a multi-module project with Android Studio and gradle, the IDE try to merge manifest files from every module into a Main manifest.
If you have a module A and a module B, and in the A manifest you declare some activity from B module, gradle will enconter a issue when merging.
Try removing cross-module reference in manifest files.
That worked for me when adding the Google Play Services
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 16
}
}
That works for me.
My library project AndroidManifest.xml miss a application element
add one will fix it.
<application
android:allowBackup="true"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
</application>
I use gradle clean projectName --info get the error information, and solve it.

Categories

Resources