Apktool icon indicating copy to clipboard operation
Apktool copied to clipboard

[BUG] Error: attribute android:dataExtractionRules not found

Open swetasamasti2310 opened this issue 2 years ago • 9 comments

Compiling Apk with attribute dataExtractionRules fails. DataExtractionRules attribute got added in android 12 i.e. app targetting android 12 (https://developer.android.com/guide/topics/data/autobackup) Information Apktool Version (apktool -version) - 2.6.1 Operating System (Mac, Linux, Windows) - All APK From? (Playstore, ROM, Other) - Any app having manifest of android:dataExtractionRules Stacktrace/Logcat main | ApkUtils | E | Compiling apk encountered error. Apk : W: /decompiled/AndroidManifest.xml:3: error: attribute android:dataExtractionRules not found. W: error: failed processing manifest. brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/z9/lmrnq8rs7r11ryfnksxbtr1w0000gn/T/brut_util_Jar_75538096012336025693464185194562265035.tmp, link, -o, /var/folders/z9/lmrnq8rs7r11ryfnksxbtr1w0000gn/T/APKTOOL6219217766914248629.tmp, --package-id, 127, --min-sdk-version, 26, --target-sdk-version, 31, --version-code, 109, --version-name, 109.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -e, /var/folders/z9/lmrnq8rs7r11ryfnksxbtr1w0000gn/T/APKTOOL560981117956261954.tmp, -0, arsc, -I, /Users/swetakumari/Library/apktool/framework/1.apk, --manifest,

Steps to Reproduce apktool Add android:dataExtractionRules in the apk and try to recompile.

Frameworks If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files (.apks that live in /system/framework or /system/priv-app)

APK Any apk with dataExtractionRules attribute enabled in AndroidManifest file will have this error. PFA for the sample apk. SwetaSampleApp.zip

Questions to ask before submission Have you tried apktool d, apktool b without changing anything? - Yes If you are trying to install a modified apk, did you reassign it? - Yes Are you using the latest apktool version? - Yes

swetasamasti2310 avatar Jun 15 '22 11:06 swetasamasti2310

Confirmed. Made a failing test case for now. My guess is I need to rebuild aapt binaries.

https://github.com/iBotPeaches/Apktool/pull/2838

iBotPeaches avatar Jun 20 '22 11:06 iBotPeaches

Do we have any tentative date when the 2.6.2v will get released with this data extraction attribute fix involved ?

swetasamasti2310 avatar Jul 01 '22 06:07 swetasamasti2310

Im just adding myself to the issue as Ive hit this with berrybrowser, to get notified if I can help in testing..

I: Using Apktool 2.6.1
I: Smaling smali folder into classes.dex...
I: Building resources...
W: /home/userx/build/ADTools/decompiled/berry.apk/AndroidManifest.xml:42: error: No resource identifier found for attribute 'dataExtractionRules' in package 'android'
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_14654990548826782454827711967953891264.tmp, p, --forced-package-id, 127, --min-sdk-version, 25, --target-sdk-version, 29, --version-code, 359030, --version-name, 3.59.3,
--no-version-vectors, -F, /tmp/APKTOOL13464032806987482991.tmp, -0, arsc, -I, /home/userx/.local/share/apktool/framework/1.apk, -S, /home/userx/build/ADTools/decompiled/berry.apk/res, -M,
/home/userx/build/ADTools/decompiled/berry.apk/AndroidManifest.xml]

biopsin avatar Jul 04 '22 17:07 biopsin

aapt binaries + latest framework were added to master. So I will revisit this now.

iBotPeaches avatar Jul 10 '22 13:07 iBotPeaches

Hi, I have the same problem, are there any workaround on this?

dejawho avatar Aug 08 '22 23:08 dejawho

@iBotPeaches Hello, please add the build aapt, aapt2 for Android arm7, arm64, x86, x64

Quite a few people know how to build the correct binaries for compiling resources

timscriptov avatar Aug 09 '22 02:08 timscriptov

@iBotPeaches when will a fix be complete?

hackermondev avatar Aug 11 '22 12:08 hackermondev

@iBotPeaches when will a fix be complete?

I don't know - accepting any fixes or research.

iBotPeaches avatar Aug 11 '22 12:08 iBotPeaches

FYI:

For me, the following method worked fine:

$ git clone https://github.com/iBotPeaches/Apktool.git
$ cd Apktool
$ ./gradlew build shadowJar
$ cp brut.apktool/apktool-cli/build/libs/apktool-cli-all.jar apktool.jar
$ java -jar apktool.jar empty-framework-dir --force
$ # and use the apktool.jar instead of one I used..

takeh1k0 avatar Sep 07 '22 05:09 takeh1k0

I was facing the same issue... But I am working on a React Native app and I could solve the issue by downgrading Node.js 18.12 to 16.17. I do not know if this is related at all to this, but I'll leave a comment here just in case it helps somebody.

guplem avatar Nov 10 '22 11:11 guplem

FYI:

For me, the following method worked fine:

$ git clone https://github.com/iBotPeaches/Apktool.git
$ cd Apktool
$ ./gradlew build shadowJar
$ cp brut.apktool/apktool-cli/build/libs/apktool-cli-all.jar apktool.jar
$ java -jar apktool.jar empty-framework-dir --force
$ # and use the apktool.jar instead of one I used..

not working for me.

i think the problem is the SDK version , this error occur on machine with new SDK version

0xmajoroil avatar Dec 21 '22 14:12 0xmajoroil

Hi @iBotPeaches Please confirm if this bug "attribute android:dataExtractionRules not found" is fixed in the latest apktool which is 2.7.0

swetasamasti2310 avatar Jan 05 '23 07:01 swetasamasti2310

Same problem with last version

java -jar /opt/tools/10_Android/apktool/apktool_2.7.0.jar b --use-aapt2 MiO2_resources



Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.7.0
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: <APK>_resources/AndroidManifest.xml:17: error: attribute android:dataExtractionRules not found.

derekkddj avatar Jan 13 '23 12:01 derekkddj

Same with apktool 2.7.0 on Mac OS

Schwartzblat avatar Jan 28 '23 22:01 Schwartzblat

For me the solution turned out to be

rm -rf ~/.local/share/apktool

as recommended in https://github.com/iBotPeaches/Apktool/issues/2712#issuecomment-1100296423

krzys-h avatar Mar 03 '23 20:03 krzys-h

For me the solution turned out to be

rm -rf ~/.local/share/apktool

as recommended in #2712 (comment)

This also works for me.

RichardHoOoOo avatar Mar 08 '23 12:03 RichardHoOoOo

Hi everyone - I would like to ask, if this issue are already resolve?

Also, I encountering this issue right now in my android build. I am using hybrid app which is the ionic capacitor

Task :app:processDebugResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:processDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource linking failed /Users/runner/work/1/s/android/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml:121: AAPT: error: attribute android:dataExtractionRules not found.

  • Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:200) at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:198) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109) at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)

RenzoPH avatar May 17 '23 02:05 RenzoPH

Was probably fixed when we updated the internal frameworks, but upcoming release (if it isn't) will resolve this.

➜  2834 apktool d sweta-tracks-debug.apk -r -f
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.7.1-7a22af-SNAPSHOT on sweta-tracks-debug.apk
I: Copying raw manifest...
I: Copying raw resources...
I: Baksmaling classes.dex...
I: Baksmaling classes4.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
➜  2834 apktool b sweta-tracks-debug --use-aapt2
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.7.1-7a22af-SNAPSHOT
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes4 folder into classes4.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether resources has changed...
I: Copying raw resources...
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk into: sweta-tracks-debug/dist/sweta-tracks-debug.apk
➜  2834 

iBotPeaches avatar Jul 04 '23 19:07 iBotPeaches

I'm using 2.9.0 and it's still there? ![image](https://github.com/iBotPeaches/Apktool/assets/1309656/63b22c26-a398-47e8-951d-5575a35b3bc example_app.zip 4)

$ S:\ProgramData\Oracle\Java\javapath\java.exe -Xmx512m -jar V:\Data\apktool_2.9.0.jar b V:\Downloads\com.evgeniysharafan.tabatatimer_org.apk-decompiled --use-aapt2
I: Using Apktool 2.9.0
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: V:\Downloads\com.evgeniysharafan.tabatatimer_org.apk-decompiled\AndroidManifest.xml:35: error: attribute android:dataExtractionRules not found.
W: V:\Downloads\com.evgeniysharafan.tabatatimer_org.apk-decompiled\AndroidManifest.xml:35: error: attribute android:enableOnBackInvokedCallback not found.
W: V:\Downloads\com.evgeniysharafan.tabatatimer_org.apk-decompiled\AndroidManifest.xml:35: error: attribute android:localeConfig not found.
W: error: failed processing manifest.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [S:\Users\owyn\AppData\Local\Temp\brut_util_Jar_62898018191614175125414952401869359530.tmp, link, -o, S:\Users\owyn\AppData\Local\Temp\APKTOOL2595703900026841314.tmp, --package-id, 127, --min-sdk-version, 21, --target-sdk-version, 33, --version-code, 502004, --version-name, 5.2.4, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --no-compile-sdk-metadata, -e, S:\Users\owyn\AppData\Local\Temp\APKTOOL1676057706290569081.tmp, -0, arsc, -I, S:\Users\owyn\AppData\Local\apktool\framework\1.apk, --manifest, V:\Downloads\com.evgeniysharafan.tabatatimer_org.apk-decompiled\AndroidManifest.xml, V:\Downloads\com.evgeniysharafan.tabatatimer_org.apk-decompiled\build\resources.zip]
Process exited with code 1.

Owyn avatar Nov 02 '23 19:11 Owyn

@Owyn - Can you run apktool empty-framework-dir and try again?

iBotPeaches avatar Nov 02 '23 19:11 iBotPeaches

@Owyn - Can you run apktool empty-framework-dir and try again?

S:\Users\owyn>apktool empty-framework-dir
W: Can't empty framework directory, no file found at: S:\Users\owyn\AppData\Local\apktool\framework\1.apk

Edit: - after renaming apktool_2.9.0.jar to apktool.jar it started working I think, I guess that was important?

Owyn avatar Nov 02 '23 19:11 Owyn