Android studio导入eclipse项目

文章目录

    • Android studio导入eclipse项目
      • 1,Import Project
      • 2,在下面两个文件编辑(根据已有Android Studio项目对应文件编辑)
      • 我的Android Studio项目对应文件
      • 更改后的Eclipse文件
      • 更改另个文件
      • 更改Main文件
      • 最后调整注释乱码问题

Android studio导入eclipse项目

方法如下(21/3/7)这里前提是已有Android Studio项目可以运行

1,Import Project

Android studio导入eclipse项目_第1张图片

Android studio导入eclipse项目_第2张图片

2,在下面两个文件编辑(根据已有Android Studio项目对应文件编辑)

Android studio导入eclipse项目_第3张图片


我的Android Studio项目对应文件

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.viewmodeltest"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

更改后的Eclipse文件

apply plugin: 'com.android.application'

android {
    //compileSdkVersion 17
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "sziit.lihz.ch01_1"
        //minSdkVersion 17
        //targetSdkVersion 17
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}
//dependencies {
//    //noinspection GradleCompatible
//    implementation  'com.android.support:support-v4:'
//}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

更改另个文件

Android studio导入eclipse项目_第4张图片


更改Main文件

Android studio导入eclipse项目_第5张图片


最后调整注释乱码问题

Android studio导入eclipse项目_第6张图片

你可能感兴趣的:(Android,android,studio,eclipse,android,google)