Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] error: 'shortService' is incompatible with attribute foregroundServiceType #3673

Closed
liaojidong opened this issue Aug 20, 2024 · 11 comments · Fixed by #3674
Closed

[BUG] error: 'shortService' is incompatible with attribute foregroundServiceType #3673

liaojidong opened this issue Aug 20, 2024 · 11 comments · Fixed by #3674

Comments

@liaojidong
Copy link

liaojidong commented Aug 20, 2024

Information

  1. Apktool Version (v2.9.3)
  2. Operating System (Windows)
  3. APK From? (Other)
  4. Java Version (java11)

Stacktrace/Logcat

error: 'shortService' is incompatible with attribute foregroundServiceType (attr) flags [camera=64, connectedDevice=16, dataSync=1, location=8, mediaPlayback=2, mediaProjection=32, microphone=128, phoneCall=4].

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything?
    yes
  2. If you are trying to install a modified apk, did you resign it?
    yes
  3. Are you using the latest apktool version?
    yes
@liaojidong
Copy link
Author

liaojidong commented Aug 20, 2024

Hello, after using the new feature of Android 14 "Android:foregroundServiceType="shortService"", we found that the tag cannot be recognized.

@iBotPeaches iBotPeaches changed the title [BUG] [BUG] error: 'shortService' is incompatible with attribute foregroundServiceType Aug 20, 2024
@iBotPeaches
Copy link
Owner

I added this property to our test case and I can't replicate an issue. Can you confirm my test change is accurate to your change?

#3674

@liaojidong
Copy link
Author

I added this property to our test case and I can't replicate an issue. Can you confirm my test change is accurate to your change?

#3674
I simply added android:foregroundServiceType="shortService" and an error was reported, with no additional steps.As shown in the picture below
}FTJED9Y9(C_M)R0Y}WQ{5Q

@liaojidong
Copy link
Author

I may know the reason. Maybe our environment variable points to the Android 13 SDK. I'll give it a try. Thanks.

@iBotPeaches
Copy link
Owner

Okay, I'll close this with the update to our test suite. You can test a bleeding edge build from here: https://github.com/iBotPeaches/Apktool/actions/runs/10451894924

@liaojidong
Copy link
Author

@iBotPeaches Hello, does Apktool use the aapt2 tool? How did you find the location of this tool? I found that the problem still exists:
I: Using Apktool 2.9.3
I: Copying works\20240820185519\tmp\vngjw1m classes.dex file...
I: Copying works\20240820185519\tmp\vngjw1m classes2.dex file...
I: Copying works\20240820185519\tmp\vngjw1m classes3.dex file...
I: Copying works\20240820185519\tmp\vngjw1m classes4.dex file...
I: Copying works\20240820185519\tmp\vngjw1m classes5.dex file...
I: Copying works\20240820185519\tmp\vngjw1m classes6.dex file...
I: Copying works\20240820185519\tmp\vngjw1m classes7.dex file...
I: Checking whether resources has changed...
I: Building resources...
I: Using Apktool 2.9.3
I: Checking whether resources has changed...
I: Building resources...
XG-PACK [XGTrace] post data , msg is {"action":"xgAndroidPackage","action_time":"2024-08-20 18:57:35.297","channels_id":"vngjw1m","game_id":"2138","java_home":"D:\Java\jdk-11","java_version":"11.0.23","msg_id":"6d91cc50c71c4338aa9bfc2a93271976","os_name":"Windows 10","plan_id":"3609","remark":"ApkToolService compressByCommand Error. error msg = W: warn: removing resource vn.pg1.vltk1m:string/tt_request_permission_descript_external_storage without required default value.\nW: warn: removing resource vn.pg1.vltk1m:string/tt_request_permission_descript_location without required default value.\nW: warn: removing resource vn.pg1.vltk1m:string/tt_request_permission_descript_read_phone_state without required default value.\nW: E:\xgsdk-cmd-2.0\works\20240820185519\tmp\vngjw1m\AndroidManifest.xml:252: error: 'shortService' is incompatible with attribute foregroundServiceType (attr) flags [camera=64, connectedDevice=16, dataSync=1, location=8, mediaPlayback=2, mediaProjection=32, microphone=128, phoneCall=4].\nW: error: failed processing manifest.\nbrut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\admin\AppData\Local\Temp\brut_util_Jar_23061200895949463002225971217076768120.tmp, link, -o, C:\Users\admin\AppData\Local\Temp\APKTOOL14500750697720793108.tmp, --package-id, 127, --min-sdk-version, 21, --target-sdk-version, 34, --version-code, 999911111, --version-name, 2.1.45, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --no-compile-sdk-metadata, --warn-manifest-validation, -e, C:\Users\admin\AppData\Local\Temp\APKTOOL17165529994042334198.tmp, -0, arsc, -I, C:\Users\admin\AppData\Local\apktool\framework\1.apk, --manifest, E:\xgsdk-cmd-2.0\works\20240820185519\tmp\vngjw1m\AndroidManifest.xml, E:\xgsdk-cmd-2.0\works\20240820185519\tmp\vngjw1m\build\resources.zip]\n","result":"failure","sdk_version":"2.5","user_name":"liaojidong1"}
XG-PACK [XGTrace] post data success, ret is
XG-PACK com.xgsdk.pkgtool.core.packing.exception.StopException: ApkToolService compressByCommand Error. error msg = W: warn: removing resource vn.pg1.vltk1m:string/tt_request_permission_descript_external_storage without required default value.
W: warn: removing resource vn.pg1.vltk1m:string/tt_request_permission_descript_location without required default value.
W: warn: removing resource vn.pg1.vltk1m:string/tt_request_permission_descript_read_phone_state without required default value.
W: E:\xgsdk-cmd-2.0\works\20240820185519\tmp\vngjw1m\AndroidManifest.xml:252: error: 'shortService' is incompatible with attribute foregroundServiceType (attr) flags [camera=64, connectedDevice=16, dataSync=1, location=8, mediaPlayback=2, mediaProjection=32, microphone=128, phoneCall=4].
W: error: failed processing manifest.

@iBotPeaches
Copy link
Owner

We don't find it. It's included within the tool.

@liaojidong
Copy link
Author

liaojidong commented Aug 20, 2024

We don't find it. It's included within the tool.
@iBotPeaches The error below seems to come from aapt2. Do you need to upgrade the version of aapt2?
error: 'shortService' is incompatible with attribute foregroundServiceType (attr) flags [camera=64, connectedDevice=16, dataSync=1, location=8, mediaPlayback=2, mediaProjection=32, microphone=128, phoneCall=4].

@iBotPeaches
Copy link
Owner

Thats why I asked you to try a bleeding edge Apktool - it has a newer aapt2 inside - https://github.com/iBotPeaches/Apktool/actions/runs/10451894924

@liaojidong
Copy link
Author

liaojidong commented Aug 21, 2024

Thats why I asked you to try a bleeding edge Apktool - it has a newer aapt2 inside - https://github.com/iBotPeaches/Apktool/actions/runs/10451894924

@iBotPeaches I used the version Apktool v2.9.2-64-62ad27a5-SNAPSHOT you provided and still reported the same error. hope you can help me.

9}NF({T9P5(5J3(`Y{%FJI8

@iBotPeaches
Copy link
Owner

I can no longer help as I cannot replicate. Please contribute a failing test case and I can investigate further.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants