0

For a customer, I have to migrate an old Android Eclipse project which uses GoogleMaps V1 into Android Studio so changes can be made and a new APK can be compiled. There is still an older APK of this app which was compiled many years ago and after installing it I can safely confirm that it still works with all that old stuff and GoogleMaps V1.

After creating a new project (and modules) in Android Studio and copying over all the packages from the Eclipse project (this is my preferred way for migrating E projects to AS) AS is able to resolve everything but the packages from the GoogleMaps V1 API resulting in the error:

error: package com.google.android.maps does not exist

I tried everything and followed all the instructions on the web here on SO but nothing helped me.

some more background info:

I actually managed this migration like 1 or 2 years ago, but unfortunately, I don't have access to any the files anymore, so I have no clue how I achieved that and now I have to start over again. Nevertheless, because of this, I assume that technically it should still be able to have a working AS project with GoogleMapsV1. By the way, the reason why I need V1 is that we only own a GoogleMapsV1 API.

project build.gradle:

buildscript {

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

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

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

app build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 15
defaultConfig {
    applicationId "some.id"
    minSdkVersion 9
    targetSdkVersion 15
    versionCode 7
    versionName "0.9.28.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
lintOptions {
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false
}
signingConfigs {
    debug {
        storeFile file("/debug.keystore")
    }
    release {
        storeFile file("/keystore")
    }
}
buildToolsVersion '23.0.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile project(':somelib')
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
}

Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="some.package"
  android:versionCode="6" 
  android:versionName="1.2.3.0"  
  android:installLocation="auto">

<uses-sdk android:targetSdkVersion="9"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
<uses-library android:name="com.google.android.maps" />
<!--
<uses-library android:name="some.lib" />
-->

<activity android:name="some.activity"
              android:label="@string/app_name" android:icon="@drawable/icon" android:multiprocess="false" android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>   

    <service android:enabled="true" android:name="some.service" 
        android:permission="android.permission.ACCESS_FINE_LOCATION" 
        android:icon="@drawable/icon"></service>
</application>
</manifest>
Armai
  • 162
  • 1
  • 1
  • 10
  • 1
    Did you try [this](https://stackoverflow.com/questions/16748273/android-gradle-how-to-build-for-android-google-apis-4-2-2-not-for-android-4-2-2)? – Andrii Omelchenko May 13 '19 at 13:04
  • Well, I cannot perform the setup under project structure because Android Studio has changed since then but when I apply `compileSdkVersion "Google Inc.:Google APIs:15"` then I get different errors now, like `error: resource android:style/TextAppearance.Material not found.` so there seems to be some impact. Where is the difference in the expressions `compileSdkVersion "Google Inc.:Google APIs:15"` and `15`? How do I get rid of the new errors and can I also use Google Apis which are marked as obsolete in the SDK Manager like Google APIs 9? – Armai May 14 '19 at 08:19
  • 1
    Take a look at [this](https://stackoverflow.com/a/50697767/6950238). Actually its hard to help you without your project. I didn't have API v1 key. – Andrii Omelchenko May 14 '19 at 13:16
  • This seems to have helped me to get further: I changed all build tool versions (in libraries aswell) to 23.0.3, and compile SDK to "Google Inc.:Google APIs:23" and also I added app-compat-support-v7:23.0.0 everywhere and those resource errors have gone! But now, I get this error `error: failed processing manifest.`Do you have any ideas how I could get more info out why it exactly failed? – Armai May 15 '19 at 22:03
  • Take a look at [that](https://stackoverflow.com/a/53914724/6950238). – Andrii Omelchenko May 16 '19 at 08:10

0 Answers0