Considerations for migrating the Eclipse Android project to the Android studio platform

Source: Internet
Author: User

The whole place to pay attention to

Let's start by explaining the whole point of attention.

1 when creating a project in Android studio, be aware that the package name is identical to the original, otherwise there will be a lot of changes.

2 depends on the jar must be gathered up, or new project reference not to, or re-find the package, serious, that part of the code to rewrite, the impact is very bad ...

The compiler for 3Android Studio is a bit stupid. Reference to the extra package compilation will pass, but debug will error. To focus on troubleshooting android.support:appcompat-v7 and Com.android.support: SUPPORT-V4 package. These 2 bags are probably superfluous, lib there remember to delete.

Then, I recommend that the migration order be

Resource reference (RES) values under String,id, et xmlres other directory XML.

For picture files, change the folder name from Drawable-xx to Mipmap-xx

In addition to directory changes. The way resources are referenced has also changed.
Previous wording <item android:drawable= "@drawable/actionsheet_bottom_pressed" android:state_focused= "true" ></ item>//now <item android:drawable= "@mipmap/actionsheet_bottom_pressed" android:state_focused= "true" > </item>

If you don't do it, the preview view will prompt you.

Couldn ' t resolve resource @drawable/actionsheet_bottom_pressed  Failed to convert @drawable/actionsheet_bottom_ Pressed into a drawable  <item> tagged requires a ' drawable ' attribute or child tag defining a drawable

In addition, the name of the wonderful files should be changed.

For example, I found that there is such a picture actionsheet_bottom_pressed.9.png. In Android Studio reference @mipmap/actionsheet_bottom_pressed "words are not quoted ...

In order to quickly solve the problem I can only change the file name, and then bulk replace (replace).

Encoding of the migration file for the code

The Devil's idiot. Eclipse uses ANSI (window-1252) encoding. To change to a non-BOM UTF-8(I use notepad++ to go, command line batch processing, I will not ...). Otherwise, Android Studio can not recognize the Chinese, I say several times, no BOM UTF-8, no BOM UTF-8, no BOM UTF-8, no BOM UTF-8 ......

No BOM is emphasized because it would be a mistake not to do it.

Illegal characters: ' \ufeff '

  

Android Studio is based on file directory management. Open the file crud externally, after some time, the IDE will automatically sync

References to resources in Java code

drawable →_→ mipmap

Temporarily encounter these problems, I think, since the migration so the egg hurts, then this thing I can not do in the future do not do, must do, just wait for me to finish the obsessive-compulsive disorder after the attack ....

Reference Links:

How does the XML file under Android Studio drawable call the mipmap picture resource?

Android Studio R File not found

Considerations for migrating the Eclipse Android project to the Android studio platform

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.