Reputation: 21
I updated to Android 3.4 and I'm Working on a TO-DO app and when I wanna run it but it is giving me this error:
Executing tasks: [:app:assembleDebug]
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources FAILED
Execution failed for task ':app:mergeDebugResources'
>1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\CHARAN\Desktop\Android Development\BPTODO\app\src\main\res\drawable-v24\ic_launcher_foreground.xml:11: error: not well-formed (invalid token).
C:\Users\CHARAN\Desktop\Android Development\BPTODO\app\src\main\res\drawable-v24\ic_launcher_foreground.xml: error: file failed to compile.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 35s
8 actionable tasks: 1 executed, 7 up-to-date
I tried
1. clean and rebuild
2. invalidate caches and Restart
3. changing gradle dependencies
and this what android studio suggested
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
And even tried this
Gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Gradle(app)
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.bptodo"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
Activity_main.xml
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F4F4F4"
tools:context=".MainActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#1eea40"
android:layout_height="198dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_marginLeft="16dp"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/titlepage"
android:layout_marginTop="20dp"
android:textSize="32sp"
android:textColor="#FFF"
android:text="TO DO's"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/subtitlepage"
android:textSize="18sp"
android:textColor="#4A4E6A"
android:layout_marginTop="8dp"
android:text="Finish Them Quickly Today"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="@+id/btnAddNew"
android:layout_width="99dp"
android:layout_height="52dp"
android:layout_marginLeft="60dp"
android:layout_marginTop="35dp"
android:background="@drawable/bgbtnnew"
android:text="+"
android:textAlignment="center"
android:textColor="#FFF"
android:textSize="38sp" />
</LinearLayout>
<View
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:background="#131E69"
android:layout_height="1dp" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/ourdoes"
android:layout_width="match_parent"
android:layout_marginTop="-60dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<TextView
android:id="@+id/endpage"
android:textSize="16sp"
android:textColor="#9A9A9A"
android:layout_marginTop="20dp"
android:text="No More Does"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
“I expect the output of smooth run, Please Help" Thanks in advance
Upvotes: 1
Views: 5352
Reputation: 97
Build > Clean Project
Or
./gradlew clean build
Or
In the individual apps's build.gradle section android {}
, insert :
aaptOptions {
cruncherEnabled = false
}
Upvotes: 2
Reputation: 4090
Check the file: res\drawable-v24\ic_launcher_foreground.xml
Your error says it's not well formed. It means that there are some syntax error or typo or missing brackets or maybe no images.
Upvotes: 0