Unity3d access to mobile mm Payment SDK (strong networking) issues

Source: Internet
Author: User

Original address: http://blog.csdn.net/lihandsome/article/details/11919113

Because the mobile mm Payment SDK only provides Android version, to write an Android project and then package to regenerate a jar for the Unity3d engine to use, this Part I do not write, the web also provides a lot of tutorials, mainly after the successful call, the following error will occur:

1.failed to find resource file (Mmiap.xml}

06-28 05:14:09.746:e/d (4709): Failed to find resource file (Mmiap.xml}
06-28 05:14:09.776:d/androidruntime (4709): Shutting down VM
06-28 05:14:09.776:W/DALVIKVM (4709): Threadid=1:thread exiting with uncaught exception (group=0x40a71930)
06-28 05:14:09.786:e/androidruntime (4709): FATAL exception:main
06-28 05:14:09.786:e/androidruntime (4709): java.lang.NullPointerException
06-28 05:14:09.786:e/androidruntime (4709):
At MM.PURCHASESDK.D.A.A (Unknown Source)
06-28 05:14:09.786:e/androidruntime (4709):
At MM.PURCHASESDK.F.A (Unknown Source)
06-28 05:14:09.786:e/androidruntime (4709):
At Mm.purchasesdk.Purchase.init (Unknown Source)

This is because after repackaging the jar, the APK program has not been able to find the original XML files, need to refer to the apk outside, but also can not directly unzip add in, be sure to use a certain tool.

Tools are: Apktool,aapt,jarsigner

But because the XDA forum people in the last few months has developed a new apktool, called: androidmultitool, this tool is very useful, has integrated all the above features, you can use this tool. Well, don't say much nonsense.

The approximate process is:

1, anti-compilation apk

2, recompile to APK

3, use the AAPT tool to add copyrightdeclaration.xml,mmiap.xml,version these three files to the root directory of the APK

4. Re-sign APK, Success!

Here is the corresponding step:

As for the third step, it is under the Androidmultitool folder below the Program_files AAPT program:

The red is the file I added myself to add them to the RUN0.APK program.

The other three steps I will not say more, mainly about the 3rd step: the use of AAPT tools.

We mainly use two command lines (other commands to find it on their own online, very powerful):

Aapt.exe l run0.apk (This command is to list the directory of the resource files inside the APK)

Aapt.exe a run0.apk mmiap.xml (this command is to add the Mmiap.xml file to the run0.apk)

Of course, we have to add three files to the inside, each command line is not written, we can write their own line.

Once you're done, you can re-sign it!

Androidmultitool tool download, give a link to everyone: http://forum.xda-developers.com/showthread.php?t=2326604.

Because someone said in the English website can not download, fill a csdn download bar ~ No Points ~

http://download.csdn.net/detail/lihandsome/6582863

In addition, you can directly use my own batch processing (understand the use of batch processing relatively fast):

Del newtemp.apk
Java-jar "Apktool.jar" D-F temp.apk tmpandroid
Java-jar "Apktool.jar" B-f tmpandroid run1.apk
RD/S/q tmpandroid
Aapt.exe a run1.apk mmiap.xml copyrightdeclaration.xml VERSION
Java-jar Signapk.jar Testkey.x509.pem testkey.pk8 run1.apk run_signed.apk
Del run1.apk
Zipalign.exe-v 4 run_signed.apk newtemp.apk
Del run_signed.apk

In addition: Some people said that found another mistake, is not to read the MM charge jar package inside the picture resources, this problem is because unity on the APK package, the jar package inside the resources inside, the solution is:

1, first unpack the jar package, the inside of the resource folder (Mmiap this folder) to take out

2, create a new Streamingassets folder under the root directory of the assets folder in the Unity project

3, copy the Mmiap folder to the Streamingassets folder.

The catalogue finally becomes: \assets\streamingassets\mmiap\image\vertical\ the picture below

Reprint please indicate the source, thank you. http://blog.csdn.net/lihandsome/article/details/11919113

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.