error due to namespace prefix in AndroidManifest.xml

オープン
#202 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
android, java

調査の方向性

Start with the reported app/AndroidManifest.xml and reproduce using the APKEditor decompile and build commands in the issue; compare the default build with the -t json path. Read the reported manifest namespace and attribute errors in the stack traces to trace where each input path handles the Android namespace. Done means both decompile-and-recompile paths succeed for the supplied APK.

索引モデルが issue の本文から書いたものです。

説明

bug

Describe the bug

On trying to decompile and recompile this, I get this error:

ERROR:
java.lang.IllegalArgumentException: java.io.IOException: at app\AndroidManifest.xml [line
= 8]
Unknown attribute name 'n0:versionCode'
        at com.reandroid.apk.xmlencoder.XMLEncodeSource.getBytes(XMLEncodeSource.java:53)
        at com.reandroid.archive.ByteInputSource.openStream(ByteInputSource.java:38)
        at com.reandroid.apk.ApkModule.getAndroidManifest(ApkModule.java:870)
        at com.reandroid.apkeditor.smali.SmaliCompiler.buildDexFiles(SmaliCompiler.java:53
)
        at com.reandroid.apk.ApkModuleEncoder.encodeDexFiles(ApkModuleEncoder.java:152)
        at com.reandroid.apk.ApkModuleEncoder.scanDirectory(ApkModuleEncoder.java:45)
        at com.reandroid.apkeditor.compile.Builder.buildXml(Builder.java:106)
        at com.reandroid.apkeditor.compile.Builder.runCommand(Builder.java:46)
        at com.reandroid.apkeditor.Options.runCommand(Options.java:59)
        at com.reandroid.apkeditor.Main.run(Main.java:136)
        at com.reandroid.apkeditor.Main.execute(Main.java:72)
        at com.reandroid.apkeditor.Main.main(Main.java:57)
Caused by: java.io.IOException: at app\AndroidManifest.xml [line = 8]
Unknown attribute name 'n0:versionCode'
        at com.reandroid.arsc.chunk.xml.ResXmlAttributeArray.parse(ResXmlAttributeArray.ja
va:311)
        at com.reandroid.arsc.chunk.xml.ResXmlElement.parse(ResXmlElement.java:524)
        at com.reandroid.arsc.chunk.xml.ResXmlDocumentOrElement.parseInnerNodes(ResXmlDocu
mentOrElement.java:275)
        at com.reandroid.arsc.chunk.xml.ResXmlDocument.parse(ResXmlDocument.java:276)
        at com.reandroid.apk.xmlencoder.XMLEncodeSource.encode(XMLEncodeSource.java:83)
        at com.reandroid.apk.xmlencoder.XMLEncodeSource.getArray(XMLEncodeSource.java:65)
        at com.reandroid.apk.xmlencoder.XMLEncodeSource.getBytes(XMLEncodeSource.java:51)
        ... 11 more
Caused by: java.io.IOException: Unknown attribute name 'n0:versionCode'
        at com.reandroid.arsc.chunk.xml.ResXmlAttribute.encodeAttributeName(ResXmlAttribut
e.java:707)
        at com.reandroid.arsc.chunk.xml.ResXmlAttribute.encode(ResXmlAttribute.java:710)
        at com.reandroid.arsc.chunk.xml.ResXmlAttributeArray.parse(ResXmlAttributeArray.ja
va:309)
        ... 17 more

If I instead decompile and recompile with -t json, I get:

ERROR:
java.lang.IllegalArgumentException: java.io.IOException: AndroidManifest.xml: Provided uri
=http://schemas.android.com/apk/res/android, but missing: prefix
        at com.reandroid.apk.ApkModule.getAndroidManifest(ApkModule.java:881)
        at com.reandroid.apkeditor.smali.SmaliCompiler.buildDexFiles(SmaliCompiler.java:53
)
        at com.reandroid.apk.ApkModuleEncoder.encodeDexFiles(ApkModuleEncoder.java:152)
        at com.reandroid.apk.ApkModuleEncoder.scanDirectory(ApkModuleEncoder.java:45)
        at com.reandroid.apkeditor.compile.Builder.buildJson(Builder.java:75)
        at com.reandroid.apkeditor.compile.Builder.runCommand(Builder.java:48)
        at com.reandroid.apkeditor.Options.runCommand(Options.java:59)
        at com.reandroid.apkeditor.Main.run(Main.java:136)
        at com.reandroid.apkeditor.Main.execute(Main.java:72)
        at com.reandroid.apkeditor.Main.main(Main.java:57)
Caused by: java.io.IOException: AndroidManifest.xml: Provided uri=http://schemas.android.c
om/apk/res/android, but missing: prefix
        at com.reandroid.apk.JsonXmlInputSource.getResXmlBlock(JsonXmlInputSource.java:55)

        at com.reandroid.apk.JsonXmlInputSource.openStream(JsonXmlInputSource.java:39)
        at com.reandroid.apk.ApkModule.getAndroidManifest(ApkModule.java:870)
        ... 9 more
Caused by: com.reandroid.json.JSONException: Provided uri=http://schemas.android.com/apk/r
es/android, but missing: prefix
        at com.reandroid.arsc.chunk.xml.ResXmlAttribute.setNamespaceFromJson(ResXmlAttribu
te.java:782)
        at com.reandroid.arsc.chunk.xml.ResXmlAttribute.fromJson(ResXmlAttribute.java:809)

        at com.reandroid.arsc.chunk.xml.ResXmlAttributeArray.fromJson(ResXmlAttributeArray
.java:266)
        at com.reandroid.arsc.chunk.xml.ResXmlElement.fromJson(ResXmlElement.java:489)
        at com.reandroid.arsc.chunk.xml.ResXmlNodeTree.nodesFromJson(ResXmlNodeTree.java:2
60)
        at com.reandroid.arsc.chunk.xml.ResXmlDocument.fromJson(ResXmlDocument.java:164)
        at com.reandroid.apk.JsonXmlInputSource.getResXmlBlock(JsonXmlInputSource.java:53)

        ... 11 more

The AndroidManifest.xml looks like this:

<?xml version='1.0' encoding='utf-8' ?>
<manifest n0:versionCode="733700004"
          n0:versionName="137.0.7337.0"
          n0:compileSdkVersion="33"
          n0:compileSdkVersionCodename="13"
          package="com.kiwibrowser.browser"
          platformBuildVersionCode="33"
          platformBuildVersionName="13" xmlns:n0="http://schemas.android.com/apk/res/android">
  <uses-sdk n0:minSdkVersion="24"
            n0:targetSdkVersion="34" />

To Reproduce

  1. Download this
  2. Run java -jar APKEditor-1.4.4.jar d -i com.kiwibrowser.browser-arm64-14310011181-github.apk -o app
  3. Run java -jar APKEditor-1.4.4.jar b -i app
  4. Observe error in console
主要言語
Java
スター
2.3k
フォーク
417
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

REAndroid/APKEditor のほかの issue

REAndroid/APKEditor の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。