android project import from eclipse to Android Studio process problem disclosure

 

        I haven't developed Android for a long time. In the past, the development was based on eclipse. I want to try it with the popular android studio.

Last night, I helped a friend debug the project, downloaded and installed the debugging code, and encountered several problems.

The record is as follows:

 

1. First of all, note that studio uses Gradle to build projects by default, so you can only import an existing project , and you need to convert and add some configurations during the import process .

 

2. After two minutes, the project is opened and the R error is displayed: " cannot resolve symbol R ":

The Eclipse project originally ran fine, but the error of cannot resolve symbol R appears when imported into Android studio. Basically, there is a problem with the resource. Check as follows:

 

A. Double check the xml file, tags do not match, etc.

B. "Build->Rebuild Project" or "Build -> Clean Project", or even use the universal method: restart Studio

B. Using "Tools -> Android -> Sync Project with Gradle Files" does not work, and it also reports an error, see below:

 

3、上错误:"...:app:mergeDebugResources' Some file crunching failed, see logs for details "

 

A. Check the information to find out:

   There are many project file formats supported by Eclipse, while Studio has a single function or a single-mindedness, so it is strict with project management.

It is confirmed that the R file is lost due to the fact    that Studio does not support the image format of *.9.png . (For the meaning and production of .9 pictures in Android, see http://www.jianshu.com/p/3fd048644e3f)

B. According to the error, try to convert the *.jpg image into .png format

C. There is a big pit : the total prompt should be in png format, but the actual format is wrong

   The inspection found that the pictures all end with .png , which should be no problem. . . . . .

   For, add --debug to the last prompt of compilation (the prompt has a link to click directly) to run, and find the corresponding picture

   After the mac is opened, use the "export" function, and pay attention to see the specific problems appear:

   It turns out that Nima is in jpeg format, but he just modified the suffix to .png (the actual file format will not change, poof...)

 

After changing the new picture, "Sync Project with Gradle Files", package ok through

 

 Please attach the original chain for reprint: http://zl378837964.iteye.com/blog/2370442

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326227171&siteId=291194637