Skip to content

fixed apk , fixed method returned string not working fine #370

@miladev95

Description

@miladev95

`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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions