The invention discloses a method for software protection under ART by using a self-modifying technology, which comprises the following steps: 1. Selecting key codes to be protected of protected application; 2, extracting that key codes selected in the step 1; 3, destroy that key code extracted from the step 2, and converting the key code into a dynamically loaded dex file; 4, generating a native code for self-modification repair according to that code process in the step 3 and the initial key code; 5, protecting that native code in the step 4 by using a self-modifying state machine algorithm;Step 6: Integrally compiling and packaging the code generated in Step 5 to generate the final protected APK. Firstly, the selected key codes are extracted, then the protected dex file is constructed,and the corresponding native codes are generated according to the destruction information during the construction, and the final so library is generated for the native codes by using the self-modifying state machine algorithm. Finally, the integrated compilation and packaging generates the final protected APK.