Migrate your company's main project from Eclipse to Android studio for Mac Environment

Source: Internet
Author: User

Last week, I decided to solve the problem. The reasons are as follows:

3 months ago, I have invested a little time to do this migration work, until finally, I found that can be installed, but not run, the process also can not see the bugly upload, in the case can not find the reason, I gave up.

Later, after I downloaded the code in SVN and ran it in Esclipse, I found the app to be able to install but not run, just like the problem I encountered before. Later, I learned that the. so file is missing. And then Lenovo to the previous migration problem should be the same reason, so I also began to resolve to solve the problem.

Next, I'll sort out the problems I've encountered, and how I can fix them:

1. Download code from SVN vs yourself from Windows Copy code to MacBook

I took the first approach to the latter, and later I decided to use SVN to download the code for better updates and submissions later.

(1) I decided to use SVNX to solve the problem.

First of all, I confused the repositories and working copies, and then a little time to struggle with why working copies in the loading of the address is always less a "\" letter, and finally, check Baidu, have not found the reason.

Later, I found that I need to open repositories to make good settings.

  

(2) After the download, found to note that the import results, found that the SVNX settings downloaded file location and import generated file location is not the same, the structure of the two are very different.

This time need to consider is to upload the download code through SVNX, how to sync?

Note: Before, I didn't understand exactly where the error was? What is event log? Gradle console? Later you can be sure that you need to focus on Gradle console, which can indicate which file is problematic. Then specifically

2. At the beginning of the run, the problem of finding pictures

(1) The first is the point nine figure. The error of point nine figure is basically shown in the place where the picture is displayed in the red dot can be seen. This can be handed to the artist to deal with.

(2) Then there is the PNG issue. This issue will prompt "Libpng error:not a PNG file", some are warning, some are error errors. Then, I will Baidu, find to use "Image Magick" to solve.

(When I installed the image magick, some of the steps would have been two to skip, but I looked down and ignored this as an option.) )

After the download is installed, I will first try to convert the PNG files in a folder, and then try the folders one after another, because in the terminal, the use is similar to the

Java-jar/users/gengen/documents/imagestriptool.jar /users/gengen/documents/ict_android/new_imschat/imschat/ src/main/res/drawable-hdpi /users/gengen/documents/ict_android/new_imschat/imschat/src/main/res/ DRAWABLE-HDPI

The yellow above indicates the initial folder, and the pink below indicates the destination folder

These two file locations can be the same

(3) Use

  Aaptoptions.cruncherenabled = False
Aaptoptions.usenewcruncher = False

Ignore the PNG hint error.

3. Issues with shared jar packages

The company's project consists of four module, of which two module is common to the same jar package. At this point, the jar package needs to be extracted to generate a new module. Then, under the item that needs to use this jar package, right-click on the module setting to set the reference to this new module.

Setup issues with 4.android Studio

Next, you will encounter a hint that you need to add in USES-SDK

Tools:overridelibrary= "Com.xxx.xxx.xxx", and Application Add Tools:replace= "" after Android:icon.
This is a hint in version control.

Problem with 5.gradle build

(1) Because of the need to optimize Dex, and because the processing tool dexopt the number of IDs, resulting in the number of processing can not exceed 65,536, so in Android development, need to use to Multidex to solve this problem, Multidex can cooperate with Android Studio implements an APK that contains multiple Dex features

So in Android Studio, Build.gradule's Android has added

Defaultconfig {
multidexenabled true
}

(2) Under a module, it is suggested that various UTF-8 are not mapped, so the build.gradule of each module is added:

Tasks.withtype (javacompile) {
options.encoding = "UTF-8"

(3) quotes the

Compile (' com.google.http-client:google-http-client-android:1.21.0 ')
{Exclude group: ' Com.google.guava '}
Compile (' com.google.api-client:google-api-client-android:1.21.0 ')
{Exclude group: ' Com.google.guava '}
Compile (' com.google.api-client:google-api-client-gson:1.21.0 ')
{Exclude group: ' Com.google.guava '}
Compile (' com.google.code.gson:gson:2.4 ')
This process needs to be downloaded.
Where exclude represents the exclusion of previously compiled packages
Compile ' com.google.guava:guava:18.0 '

6. So file, since no SVN setup can download. So files, I copy the past

At first, there was no detection of where the. So file was used, and later I could view the bugly, and then I went online to find

First, add the following:

sourcesets {
Main {
Jnilibs.srcdirs = [' Libs ']
}
}
Then the name in the Armeabi in Lib is modified into armeabi-v7a,
Next, under SRC, create a new
A folder named Jnilibs, and then move the armeabi-v7a entire folder over.

7. Some methods are obsolete, so you need to add a library of this method in Gradule.build, for example:

Uselibrary ' Org.apache.http.legacy '
Next, however, is the need to use the new Baulai method.

8. Every time a problem is re-modified, clean build and rebuild are required

Overall, I need to pay attention to every version of an Android studio upgrade.

Then, because of their own many things are not familiar with Android, so Baidu needs to find a way to solve the problem quickly, but also I have to ponder over the use of each method of logic.

Migrate your company's main project from Eclipse to Android studio for Mac Environment

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.