Method and steps of converting eclipse project to Android studio compatible mode

Method / step

Prepare the project to be converted. It is best to create a new folder, and then put the main project and dependent project in the same directory

Screenshot 2016-12-24 12.43.02.png

Import the main project and dependent project in eclipse. After importing, you'd better run it again and confirm that there is no problem before continuing

Screenshot 2016-12-24 12.40.03.png

Right click export on the main project

Screenshot 2016-12-24 12.53.51.png

Exporting the project to generate gradle build files is very important. Only exporting to this mode can be compatible with Android studio, that is, the project can run on both eclipse and Android studio

Screenshot 2016-12-24 12.55.00.png

Click next to select both the main project and the dependent project

Screenshot 2016-12-24 13.01.00.png

In the next step, you'd better select force overriding of existing files to prevent similar operations from generating some files

Screenshot 2016-12-24 13.03.17.png

Click Finish to see the status in the figure. Continue to click finish. So far, the operation on eclipse is completed

Screenshot 2016-12-24 13.06.12.png

After the above operations are completed, there are several more files in the folder of the workspace

Screenshot 2016-12-24 13.23.17.png

Before importing Android studio, we need to change two files

Screenshot 2016-12-24 13.41.15.png

Screenshot 2016-12-24 13.42.48.png

Screenshot 2016-12-24 13.43.44.png

After modifying the above two files, you can open the project with Android studio and select this option in Android studio

Screenshot 2016-12-24 13.47.41.png

Select the directory of the whole file to import. Note that it is best to connect the computer to the network. When Android studio imports this project, it will automatically download some things from the Internet

Screenshot 2016-12-24 13.49.43.png

Open the build.gradle file of the main project and add the following contents. Dependent projects can also be added, but the applicationid is not required under the defaultconfig of dependent projects

Screenshot 2016-12-24 15.52.26.png

After running the program, we will find that the compilation fails. It doesn't matter. Look at the error log and make changes according to the error contents and suggestions. This step must be patient. Different projects will have different errors, most of which are errors such as duplicate manifest files or jar packages. After solving them, we can run the program successfully. After the Android studio program runs, open eclipse, Just as perfect

Screenshot 2016-12-24 16.02.12.png

Screenshot 2016-12-24 16.02.32.png

END

Note: different versions of eclipse and Android studio may have different effects. When I wrote this experience, I used the ADT version of eclipse as 22 and the Android studio version as 2.2.3

summary

The above is the method and steps of converting eclipse project into Android studio compatible mode introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>