alibaba / alibaba/AndFix

fixed apk , fixed method returned string not working fine

Open
#370 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

`public class App extends Application {

private static final String TAG = "test";

private static final String APATCH_PATH = "/out.apatch";
/**
* patch manager
*/
private PatchManager mPatchManager;

@Override
public void onCreate() {
super.onCreate();
// initialize
mPatchManager = new PatchManager(this);
mPatchManager.init("1.0");
Log.d(TAG, "inited.");

// load patch
mPatchManager.loadPatch();
Log.d(TAG, "apatch loaded.");

// add patch at runtime
try {
// .apatch file path
String patchFileString = Environment.getExternalStorageDirectory()
.getAbsolutePath()+"/Download" + APATCH_PATH;
mPatchManager.addPatch(patchFileString);
Log.d(TAG, "apatch:" + patchFileString + " added.");
} catch (Exception e) {
Log.e(TAG, "", e);
Toast.makeText(getApplicationContext(),"catch : "+e.getMessage(),Toast.LENGTH_LONG).show();
}

}

}
`

`class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
main_txt.text = sayGoodBye()
Toast.makeText(this,sayGoodBye(),Toast.LENGTH_SHORT).show()
}

fun sayGoodBye():String{
return "hello"
}
}
`

after replacing sayGoodbye function return string with goodbye string and generate apatch file with below command :
`bash apkpatch.sh -f app2.apk -t app1.apk -o . -k test.jks -p 123 -a test -e 123`
and copy apatch to sdcard/download dirctory the output is :
![Screenshot_1583495083](https://user-images.githubusercontent.com/35612406/76080933-43d96600-5fbd-11ea-898e-1deb022349b1.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the report using apkpatch.sh, the shown App patch-loading flow, and MainActivity.sayGoodBye(), comparing the original and patched APKs. Check the generated .apatch and runtime output to determine why the changed returned string is not applied. Done means the patched app reliably displays the updated string.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.