Eclipse migration to Android Studio issue record

Source: Internet
Author: User

A recent migration from Eclipse to Android Studio, the reason for the migration is, of course, a 65535 problem. The process of migration from compiling to packaging, stepping on a pile of pits, here to record, hoping to help, also by the pit of the peer

How to Import

It is recommended to import with ADT directly, which will automatically add dependencies for you to build a good code architecture

Once you have selected the project for Eclipse and the target project to import, the default options for the Finish option, direct next

Silently praying, and waiting for the import to end

Start slowly pits the road

As construction project completed, the error is positive, first to see the first error

Naming non-canonical


This error is very well understood, the name is not standardized problems, according to the requirements of the change can be

.9 does not meet the requirements

.9 non-compliance is a very common situation, and Eclipse's requirements for. 9 are not as stringent as in Android Studio

This is often the case in eclipse projects. 9, four-sided and not all the pixels.

The way I handle it here is to repaint. 9, add the sideline.

Libpng warning ICCP & libpng error:not a Png file

Not Png file Fortunately said to find the file format is not the right to change the suffix, but if a lot of pictures in the project can not find what to do? I'll tell you later.

There are libpng warning ICCP more pits, this error directly report V7 package inside the resources, the cause of the problem, I am also more puzzling. If anyone knows the message, please let me know.

My solution is more violent, make the following configuration in the main project's Build.gradle file

Key configuration: aaptoptions.cruncherenabled = False Aaptoptions.usenewcruncher = False
You can directly ignore the libpng 2 errors

Androidmanifest.xml merge Conflict

Library engineering, which is often used in eclipse, can also be used in Android studio. In the Eclispe Library project Androidmanifest.xml, and the main project Androidmanifest.xml have the same configuration when there is no error, but in Android Studio these are not allowed

Duplicate declarations of permissions

Need to remove duplicate permissions

Application node Duplicate configuration

Allowbackup Repeating settings

Applcation Repeating settings

There are 2 ways to solve the problem, delete a project's settings, generally delete the library project, the second is the same as the compiler's advice to write Tools:replace

The tools here need to be declared before they can be used

V4 Package Error

The class is not found because the V4 package is not, but my EC project is a V4 package, as for why not after the import, I do not understand

You can set dependencies in the Build.gradle file compile ‘com.android.support:support-v4:23.2.1‘ .

Problem with insufficient memory at run time

This error is actually a JVM error, loading too much content and not enough memory.
solution, configuring in Build.gradle

    dexOptions {        "4g"    }

This configuration must be written in the android{} node.

64K problem

64k problem directly with the official scheme, set up or very simple
Add Dependencies: compile ‘com.android.support:multidex:1.0.1‘
Modify Application

    @Override    protectedvoidattachBaseContext(Context base) {        super.attachBaseContext(base);        MultiDex.install(this);    }

In the end, my project can run the BUILD SUCCESS!!! The end of the Sprinkle flowers ~ ~

========================================== Split Line

When I thought it was finished, I tried packing, and the result ... I'm crazy again.

Packaged errors

I'm packing when the formal package, not the signature, the following error will not appear.

Custom attribute error in Layout.xml file

The Layout.xml custom attribute declaration in the previous project is a direct parking name.
xmlns:app="http://schemas.android.com/apk/res/com.xxx"
But you'll get an error when you pack, Adnroid Studio suggests Res-auto

This warning level thing will become a mistake when packaged.

error:expected resource of type styleable [ResourceType]

This mistake is more wonderful, my statement is no problem. And this error will not appear during compilation,
It only happens when I'm packing, and I spit on the old blood. Fortunately, this error-solving solution is relatively simple,
That is to filter it out directly. Add annotations to the problematic class
@SuppressWarnings("ResourceType")You can filter it out.

Validfragment Error

It's also a confusing mistake.

Change directly, on the fragment to annotate the @SuppressWarnings("ValidFragment") same is to filter out the error

Missingtraslasion Error

This error is not set in the String.xml whether the configuration can be translated, but we generally do not have to use this setting, and have not seen an error. Inside the ghost is out in the Friend League project has set Values-zh cause our own project is also affected to set the translation configuration.
Solution to add configuration directly to the string.xml of the problem

<?xml version="1.0" encoding="utf-8"?><resources  xmlns:tools="http://schemas.android.com/tools"  tools:ignore="MissingTranslation" ></resources>

HOlY SHIT!!!!!

The author is Spitting blood.

Eclipse migration to Android Studio issue record

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.