【Android】从Eclipse到AndroidStudio的工程迁移

一、新建Android Studio的代码目录android

二、打开AS,选择File---->New---->Import Projectapp

 

三、在弹出的对话框选择Eclispe代码目录测试

四、选择Eclipse目录以后,在弹出的对话框中输入目标文件夹,gradle

 

五、Next以后,默认缺省的勾选项ui

 

六、等待gradle加载google

 

 七、修改build.gradle,以下图,gradle版本与本机的配置版本一致,如3.4spa

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

八、修改gradle目录,在gradle\wrapper\gradle-wrapper.properties文件中,gradle插件和gradle版本以下图插件

#Thu May 09 09:42:09 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

 

 

九、点击try again3d

 十、因为Eclipse的Android SDK 版本与Android Studio版本可能不一致,会出现以下错误,先注释AndroidManifest.xml的sdk版本信息code

 

 十一、继续try again,此处版本也可能不一致,调整一致

 

 十二、编译测试

 

1三、查看编译结果

相关文章
相关标签/搜索