Giter Club home page Giter Club logo

Comments (6)

thezhangwei avatar thezhangwei commented on June 8, 2024

Is it possible for you to share the full input. Which drawable files were modified please?

from redex.

pidanxiangjiao avatar pidanxiangjiao commented on June 8, 2024

Of course , i could send the input and output through email , please check your mailbox .Thx.
I create a demo project ,and find the same issue,
the reason for content of xml file becomes "", i think it is due to r8 compiler ,when i set "shrinkResource " to "true", r8 make useless resources file's content to be "<x/">
but after redex, the reason to cause app crash ,i guess maybe is there any logic in redex to mixup xml files' content ?
it means that, after redex , the content of xml a and the content of xml b get swaped.

why i have the guess above, is that ,when i set "shrinkResources" to "false ", in output apk , "" not exists any more, but after redex , the final apk still can not run, it gets some error still in xml file , some layout xml file' content becomes the content of drawable file's content, the error info is like "can not find classs shape ".

In the demo project i sent you:
activity_main.xml content in origin apk:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent">
    <TextView android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="0" app:layout_constraintLeft_toLeftOf="0" app:layout_constraintRight_toRightOf="0" app:layout_constraintTop_toTopOf="0"/>
    <TextView android:id="@+id/tv_name1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="@+id/tv_name" app:layout_constraintLeft_toLeftOf="0" app:layout_constraintRight_toRightOf="0" app:layout_constraintTop_toTopOf="0"/>
    <TextView android:id="@+id/tv_name2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="@+id/tv_name1" app:layout_constraintLeft_toLeftOf="0" app:layout_constraintRight_toRightOf="0" app:layout_constraintTop_toTopOf="0"/>
    <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintStart_toStartOf="0" app:layout_constraintTop_toBottomOf="@+id/tv_name2"/>
</androidx.constraintlayout.widget.ConstraintLayout>

activity_main.xml content in apk after redex:

<?xml version="1.0" encoding="utf-8"?>
<x/>

when i run final apk ,get error:

FATAL EXCEPTION: main
Process: com.netease.cloudmusic.agptest, PID: 18388
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.netease.cloudmusic.agptest/com.netease.cloudmusic.bizlib.SecondActivity}: android.view.InflateException: Binary XML file line #1 in com.netease.cloudmusic.agptest:layout/activity_main: Binary XML file line #1 in com.netease.cloudmusic.agptest:layout/activity_main: Error inflating class x
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4325)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: android.view.InflateException: Binary XML file line #1 in com.netease.cloudmusic.agptest:layout/activity_main: Binary XML file line #1 in com.netease.cloudmusic.agptest:layout/activity_main: Error inflating class x
Caused by: android.view.InflateException: Binary XML file line #1 in com.netease.cloudmusic.agptest:layout/activity_main: Error inflating class x
Caused by: java.lang.ClassNotFoundException: android.view.x                                                                                                   

from redex.

pidanxiangjiao avatar pidanxiangjiao commented on June 8, 2024

I debug the python part of redex, and find that when extract the apk , the activity_main.xml's content will become "",
the activity_main.xml's final name in apk's res folder is R5.xml.
But if i rename the origin apk to zip, and unzip the final, the activity_main.xml(R5.xml)'s content is still correct.
I use a mac to do this operation, so there should be a bug in python part when doing the extract operation.

from redex.

thezhangwei avatar thezhangwei commented on June 8, 2024

I debug the python part of redex, and find that when extract the apk , the activity_main.xml's content will become "",
the activity_main.xml's final name in apk's res folder is R5.xml.

It sounded like you were pretty close to locating the problem in code. If so would you mind sharing a code pointer? That should help us to carry forward on our side. Sorry for the delay.

from redex.

pidanxiangjiao avatar pidanxiangjiao commented on June 8, 2024

I debug the python part of redex, and find that when extract the apk , the activity_main.xml's content will become "",
the activity_main.xml's final name in apk's res folder is R5.xml.

It sounded like you were pretty close to locating the problem in code. If so would you mind sharing a code pointer? That should help us to carry forward on our side. Sorry for the delay.

I figure out that it is because the file system i'm using on mac is case insensitive, i create a case sensitive partition , finally the xml content won't get messed up anymore.

from redex.

thezhangwei avatar thezhangwei commented on June 8, 2024

I'm glad that you figured it out. Closing for now.

from redex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.