Independent of the system app in the android source code, developed like a common app, Android app

Source: Internet
Author: User

Independent of the system app in the android source code, developed like a common app, Android app
I personally recommend that you first import the formatted xml and import in the ide/eclipse of the android source code to your compiled eclipse. If the android source code you compile is of Version 2.3 or later, we recommend that you use JDK 6 or above to remind you that the new androidProject is not a Java project.
If you want to import projects that do not call the hide tag, such as javasclock and Camera, no errors will be reported for these projects. You can directly modify or study these projects, if you run the Code directly on eclipse or on your mobile phone, you may be prompted that your digital signature is incorrect. Change the project name and rewrite the digital signature, what's even worse is that, whether it's a mobile phone or a simulator, after you get the root permission, you can delete the original app and then run the source code you compiled. If the hide tag is involved, such as setting and Launcher2, see the following operations:

The following uses Launcher2 as an example to describe in detail:

1. Import the Launcher2 project to eclipse.
At this time, the Launcher2 project has been imported into eclipse, but there will be 158 errors (haha, there are so many compiling 2.3.3, and there should be more than 100 in other versions anyway, ).


2. Add the package file used by Launcher2.

In the Android source code, many methods, members, classes, and packages are tagged with @ hide, which are not disclosed in the SDK, android is the most common class used to compile the Launcher source code. view. view member mScrollX cannot be accessed. Therefore, you must first download the Android code and compile it properly, because you need to use some compiled class. jar files.

Here we use: (the generated package path is out/target/common/obj/JAVA_LIBRARIES)
1) framework_intermediates/classes. jar: This is mainly the framework class of android.
2) android-common_intermediates/classes. jar: This contains the com. android. common. Search Class
3) core_intermediates/classes. jar: This package contains the dalvik. system. VMRuntime class.
These are all packages that need to be imported into the project. You can add these packages by configuring the Build Path of the project,
Right-click the project name and choose Build Path> Configure Build Path...> Libraries> Add Library> User Libraries...> New...
Add the three dependent packages one by one and name them android_framework, android_common, and android_core respectively.
After adding the three packages, you also need to put them in front of the android2.3.3 package. You can select Order and Export IN Build Path configuration.
At this time, you will find that the Launcher2 project and there is no error, you can also compile it.



3. Modify the Launcher2 package name and run the changed Launcher2.

Change the name of the original package. Remember to use the eclipse rename mechanism (Press F2 on the package name to modify), which is not only a reference to the class, there are also many references in xml files (such as import com. android. launcher3.R;), all of which can be done at one time as long as the rename is good.

 

Enter your own package name for New name, and select all the following four items. Click "Preview"

Note: It is best not to place your project in the Chinese path. Otherwise, an error will occur during rename. I started to put the error in the Chinese path for a long time before I found the error!



4. Delete this sentence in the AndroidManifest. xml file. (Android: sharedUserId = "android. uid. shared ")

In this case, I used launcher 2.3 to perform the experiment. The result is OK and the operation is successful.





For more information about how to develop a complete and detailed Android applet source code, see

Media Player source code Audio. java
Package org. example. audio;

Import android. app. Activity;
Import android. media. MediaPlayer;
Import android. OS. Bundle;
Import android. view. KeyEvent;

Public class Audio extends Activity {
Private MediaPlayer up, down, left, right, enter;
Private MediaPlayer a, s, d, f;

@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. main );

// Native rate is 44.1 kHz 16 bit stereo,
// To save space we just use MPEG-3 22 kHz mono
Up = MediaPlayer. create (this, R. raw. up );
Down = MediaPlayer. create (this, R. raw. down );
Left = MediaPlayer. create (this, R. raw. left );
Right = MediaPlayer. create (this, R. raw. right );
Enter = MediaPlayer. create (this, R. raw. enter );
A = MediaPlayer. create (this, R. raw. );
S = MediaPlayer. create (this, R. raw. s );
D = MediaPlayer. create (this, R. raw. d );
F = MediaPlayer. create (this, R. raw. f );
}

@ Override
Public boolean onKeyDown (int keyCode, KeyEvent event ){
MediaPlayer mp;
Switch (keyCode ){
Case KeyEvent. KEYCODE_DPAD_UP:
Mp = up;
Break;
Case KeyEvent. KEYCODE_DPAD_DOWN:
Mp = down;
Break;
Case KeyEvent. KEYCODE_DPAD_LEFT:
Mp = left;
Break;
Case KeyEvent. KEYCODE_DPAD_RIGHT:
Mp = right;
Break;
Case KeyEvent. KEYCODE_DPAD_CENTER:
Case KeyEvent. KEYCODE_ENTER:
Mp = enter... the remaining full text>

How does Android put the program into SYSTEM/APP?

Hello!

Open RE manager, copy and paste the apk file to the/system directory, and change the permission so that it has the same permissions as the apk file in the system/app folder, and then move it to the pp folder, restart your phone.

I hope my answer will be useful to you and I hope it will be a satisfactory answer.
(* ^__ ^ *)

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.