Problems encountered in project migration from eclipse to studio

Concept

eclipse workspace ---> studio project
eclipse project ---> studio module

step1 :

eclipse export

export --> Android --> Generate Gradle Build files 
-->next-->next-->Check the project next-- >force overriding of existing files-->finish

step2 :

studio import project

File-->New-->Import Project-->Select directory, select build gradle file.

Problem encountered Gradle version number related gradle folder --> The distributionUrl=https\://services.gradle.org/distributions/ gradle-2.10-all.zip version number in the wrapper-->gradle-wrapper.properties file should correspond to the local gradle file version number in the build.gradle file   









dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
    }
  The version number should also correspond to the local gradle version number. <It feels greater than or equal to the relationship.> Code error related problems: httpclient prompts that the class cannot be found <android 6.0 does not support this> method: in the build.gradle file 




dependencies {
    android {
        useLibrary 'org.apache.http.legacy'
    }
}

The red font is the lib project related to the introduction of httpclient


Problem : Android Studio illegal characters: \65279
Method:
step1.File Encoding -->GBK -->Convert;
step2.File Encoding -->UTF-8 -->Convert; The
principle is probably The eclipse is in utf-8 bom format, which needs to be converted to gbk first in studio, and then converted to utf-8.

Problem: android.util.FloatMath cannot find symbols
Method : FloatMath is replaced
by Math principle This class is outdated

Other problems

================================================= _ ====================================

Introduce the so file

or the build.gradle file,
add

task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') {
    destinationDir file('$buildDir/native-libs')//Packaged destination directory
    baseName 'native-libs'//jar file name
    extension 'jar'
    from fileTree(dir: 'libs', include: '**/*.so')
    into 'lib/'
}

//Gradle low version uses Complie, high version uses JavaCompile
tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn(nativeLibsToJar)
}





dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')

 compile fileTree(dir: '$buildDir/native-libs', include: 'native-libs.jar')
    android {
        useLibrary 'org.apache.http.legacy'
    }
}


===================================================== =================================
I want to introduce a jar package, after normal complie, I find that it always prompts 'Failed to resolve: There is no problem with xxxxx'

detection path, I searched it online, a buddy encountered the same problem when eclipse transferred to studio, thanks
to him, the problem was solved by

adding in the build.gradle file
allprojects {
    repositories {
        jcenter ()
    }
}
 
fixed!

Here the eclipse version number Mars.2 Release (4.5.2)
studio version number 2.1.2
java version number 1.7

Personally, the version number related to gradle should correspond well, nothing else~

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326646377&siteId=291194637