Search code examples
androidandroid-studiogradlesony

How to build old Android project in Android Studio


I've found an old git repo. It's an Android application for Sony System Cameras.

It's for Android SDK 10

The project can be found here: https://github.com/ma1co/PMCADemo

I'm not able to build it in the newest version of Android Studio. I've added the details to the following issue: https://github.com/ma1co/PMCADemo/issues/16

I hope that maybe here more people can help me, the repo is updated the last time in 2018.


Solution

  • I changed the following files, and it is working fine to me (You need to specify the Gradle plugin according to your android studio version, my version is 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 top level

        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 app level

    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'
    }
    

    It is my output

    enter image description here