`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 :
3条答案
按热度按时间yacmzcpb1#
milad0x6d ***@***.***> 于 2020年3月6日周五 下午7:50写道:…
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 : [image: Screenshot_1583495083] < https://user-images.githubusercontent.com/35612406/76080933-43d96600-5fbd-11ea-898e-1deb022349b1.png > — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#370?email_source=notifications&email_token=ABLPWEFWRQWF2SV3QKMW2WTRGDPQLA5CNFSM4LC6SK3KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ITCQWHA>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABLPWEFOZZ6A6W453SQKAV3RGDPQLANCNFSM4LC6SK3A > .7tofc5zh2#
您好,您发的邮件我已收到!
1l5u6lss3#
你好,谢谢,我回去看看。…
On Fri, Dec 17, 2021, 3:13 AM cugyong ***@***.***> wrote: 您好,您发的邮件我已收到! — Reply to this email directly, view it on GitHub <#370 (comment)>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AIPWN5X77TF6WE3P43PC3BDURJ2RNANCNFSM4LC6SK3A > . You are receiving this because you authored the thread.Message ID: ***@***.***>