【问题标题】:How to build old Android project in Android Studio如何在 Android Studio 中构建旧的 Android 项目
【发布时间】:2019-07-20 18:54:01
【问题描述】:

我找到了一个旧的 git repo。 这是一款适用于 Sony System Cameras 的 Android 应用程序。

适用于 Android SDK 10

该项目可以在这里找到: https://github.com/ma1co/PMCADemo

我无法在最新版本的 Android Studio 中构建它。我已将详细信息添加到以下问题: https://github.com/ma1co/PMCADemo/issues/16

我希望也许这里有更多的人可以帮助我,回购是2018年最后一次更新。

【问题讨论】:

  • 您是否尝试过将 versionCode 中的命令替换为 40 之类的数字,并将 versionName 中的命令替换为虚拟数字,然后尝试同步 gradle?
  • 是的,然后我又遇到了另一个错误:/我明天可以发布结果。

标签: android android-studio gradle sony


【解决方案1】:

我更改了以下文件,它对我来说工作正常(你需要根据你的android studio版本specify Gradle插件,我的版本是3.4)

gradle-wrapper.properties

#Sun Jul 21 00:42:34 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

build.gradle 顶级

    buildscript {
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.4.0'
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
            maven {
                url "https://jitpack.io"
            }
        }
    }

build.gradle 应用级别

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
//    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.github.ma1co.pmcademo.app"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

//    compileOptions {
//        sourceCompatibility JavaVersion.VERSION_1_6
//        targetCompatibility JavaVersion.VERSION_1_6
//    }
}

//android.applicationVariants.all { variant ->
//    variant.outputs.each { output ->
//        def apkName = "PMCADemo-${output.baseName}-${variant.versionName}.apk"
//        output.outputFile = new File(output.outputFile.parent, apkName)
//    }
//}

dependencies {
    implementation 'com.github.ma1co.OpenMemories-Framework:framework:-SNAPSHOT'
    compileOnly 'com.github.ma1co.OpenMemories-Framework:stubs:-SNAPSHOT'
    implementation 'com.nanohttpd:nanohttpd:2.1.1'
}

这是我的输出

【讨论】:

  • 我已经在 SDK Manager 中安装了 SDK10 和 Gradle 构建版本,但没有结果
  • 感谢这些更改,我也可以构建应用程序,但相机需要 SDK 版本 10 的 Android 应用程序。有没有办法回到版本 10?
  • 我刚刚将 SDKVersions 更改为 10,并且 apk 也在相机上运行。
  • 为什么禁用 buildToolsVersion "25.0.2" ?
猜你喜欢
  • 2021-07-16
  • 1970-01-01
  • 2020-03-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-14
  • 2019-04-26
  • 2020-07-27
相关资源
最近更新 更多