AAPT2 error: check logs for details after Android Studio upgrade - android

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

Related

Execution failed for task ':app:processDebugManifest' after Android Studio 2.2 update

Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute activity#com.facebook.FacebookActivity#theme value=(#android:style/Theme.Translucent.NoTitleBar) from AndroidManifest.xml:28:13-72
is also present at [com.facebook.android:facebook-android-sdk:4.16.0] AndroidManifest.xml:32:13-63 value=(#style/com_facebook_activity_theme)
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:24:9-28:75 to override
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.droid.bdapp.test">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="com.test.app.app.AppBaseApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.test.app.ui.activities.WelcomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.test.engine.reader.view.test5"
android:label="#string/app_name"
android:theme="#style/AppTheme"></activity>
<activity android:name="com.test.app.ui.activities.test1" />
<activity android:name="com.test.app.ui.activities.test2" />
<activity android:name="com.test.app.ui.activities.test3" />
<activity android:name="com.test.app.ui.activities.test4" />
</application>
</manifest>
It's not Android Studio 2.2 upgrade issue, it's FB SDK released yesterday.
For now a solution is to revert to previous FB SDK in build.gradle:
dependencies {
// ...
compile 'com.facebook.android:facebook-android-sdk:4.15.0'
}
This worked for me, will track the change log and bug list on FB support to see the proper solution.
I agree with the other answer, however, I would like to propose another solution.
Stick with the theme determined by Facebook by removing android:theme="#android:style/Theme.Translucent.NoTitleBar" and keep using compile 'com.facebook.android:facebook-android-sdk:4+'
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.droid.bdapp.test">
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
Facebook wants to handle the themes for the webdialog spinners as stated in the changelog
Better handling of themes for webdialog spinners
Ref: https://developers.facebook.com/docs/android/change-log-4.x#4_16_0
Add the compile dependency with the latest version of the Facebook SDK in the build.gradle file:
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.16.0' //Or 4.16.1
}
DeadObjectExceptions Bugs fixed .
Facebook has a new version released 27Sep16.
https://developers.facebook.com/docs/android/downloads/
Most build.gradle files automatically pick up the latest version (as per install instructions). It seems 4.16.0 has a problem for a number of users. To force use of previous version until this is resolved, edit your build gradle to use the previous version.
compile ('com.facebook.android:facebook-android-sdk:4.15.0')
I'd expect this to be resolved by Facebook shortly and you can revert your build.gradle to pick up the latest version once more.

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

Android Studio doesn't recognize MainActivity though declared in AndroidManifest.xml

After pausing with work on an Android Studio project for a while, and then coming back and adding it to SVN, I can't get the project to run anymore; it seems to me that the original AndroidManifest.xml was probably lost due to a lack of proper "SVN ignore" rules, and as I created a new Android Studio project on a new machine, updated it from SVN and later commited (and also unfortunately already updated on the other machine I work on), it seems that SVN used the newer manifest file and maybe other files needed for a proper build of the project.
Besides the fact that in the current manifest file, there are several activites missing that I'll have to try to reconstruct there, I now have the problem that I always get the "Default Activity not found" error when trying to build. When I set it to .MainActivity (which is absolutely present in app/src/main/java/com.example.bla.logintest) it says "The activity 'MainActivity' is not declared in AndroidManifest.xml" and thus doesn't compile.
My manifest file now looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bla.logintest" >
<uses-permission android:name="android.permission.READ_PHONE_STATE">
<application
android:allowBackup="true"
android:icon="#mipmap/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>
<activity
android:name=".EditDB"
android:label="#string/title_activity_edit_diags"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
<activity
android:name=".EditAnswers"
android:label="#string/title_activity_edit_questions"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
</application>
</uses-permission>
</manifest>
Note: I already tried the solutions in [this similar question][1].
[1]: Default Activity not found in Android Studio "this similar question". Rebuilding and invalidating the cache doesn't get me anywhere. I also added
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
to my build.gradle, and this also didn't change anything.
I am aware that the parent to the other 2 activities is still missing and wanted to work on that problem next, but first wanted to have a working default activity.
Do you have any suggestions what I could try? I'm using Android Studio 1.3.2.
This should solve your problem.
You shouldn't write the tag inside the tag.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bla.logintest" >
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/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>
<activity
android:name=".EditDB"
android:label="#string/title_activity_edit_diags"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
<activity
android:name=".EditAnswers"
android:label="#string/title_activity_edit_questions"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
</application>
</manifest>

Compatible Android versions receiving incompatibility message on Google Play

I've researched this pretty thoroughly and so far as I can tell, all that you should have to do is use portions of the Android API the devices you're supporting will recognize, and to specify a version range in your Manifest file. I've done both of these things. (See below these paragraphs for the full Manifest file contents.)
My client has Android version 4.0.4, which should be compatible, but when she tries to download the beta via Google Play, the link says that her device (a Samsung of some sort) is incompatible.
I'm not sure what else I need to do at this point, so any advice will be a huge help.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.osu.expandablelistviewtest1" >
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="Expandable List Test 1"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="Expandable List Test 1" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.CoreConversationsActivity"
android:label="Book 2: Core Conversations (ver. 0.1)" >
</activity>
<activity
android:name=".activities.DrillsActivity"
android:label="Book 2: Drills (ver. 0.1)" >
</activity>
<activity
android:name=".activities.StreamAudioActivity"
android:label="Book 2: Streaming Audio (ver. 0.1)" >
</activity>
<activity
android:name=".activities.StreamVideoActivity"
android:label="Book 2: Streaming Video (ver. 0.1)" >
</activity>
</application>
</manifest>
As suggested in comments, the issue was with the build.gradle file. Improbably, Android Studio still doesn't update the following segment on the basis of the information in the Manifest file:
defaultConfig {
applicationId "edu.osu.expandablelistviewtest1"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
In my case, minSdkVersion had been set to 16 rather than 14, leading to issues of compatibility

Valid sdkVersion for slideme.org

I am trying to upload an apk to slidme.org
http://slideme.org/node/add/mobileapp
But I get this validation failing
Your application must have a valid sdkVersion set. You need to edit
your AndroidManifest.xml file to fix this, and then upload again the
.apk file.
What is the problem with my manifest ?
<application
android:screenOrientation="portrait"
android:icon="#drawable/icon"
android:label="#string/app_name" >
<activity
android:screenOrientation="portrait"
android:label="#string/app_name"
android:name=".Start" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="7" />
I had similar problem and solve it by:
remove:
minSdkVersion 15
targetSdkVersion 28
from gradle.
and adding :
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="26" />
to manifest.
It seems slideme isn't up to date...
Solved it by removing minSdkVersion. and refered targetSdkVersion to min version.
So in your case it will become

Categories

Resources