0

I am migrating an app from Eclipse to Android Studio. when i compile code like:

import java.awt.geom.Area;

i get

error: package java.awt.geom does not exist

build gradle

apply plugin: 'com.android.application'

android {
    //compileSdkVersion 'Google Inc.:Google APIs:8'
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.me.droider"
        minSdkVersion 13
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
        debug {
            debuggable true
        }
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    //compile files('libs/osmdroid-android-4.2.jar')
    compile files('libs/osmdroid-android-4.3.jar')
    compile 'javax.annotation:jsr250-api:1.0'
}

Any suggestions as to how to solve this? Is it a gradle issue? Should i include files and use as library?

tony gil
  • 9,424
  • 6
  • 76
  • 100
  • 2
    "Any suggestions as to how to solve this?" -- stop using classes in `java.awt.geom`. They are not part of the Android SDK. "Is it a gradle issue?" -- no. – CommonsWare Apr 21 '16 at 12:38
  • is this like, an answer? anyhow, tks! – tony gil Apr 21 '16 at 12:45
  • 1
    I do not know if this is an answer. You claim that you are migrating the app from Eclipse. That suggests that the app used to work. However, `import java.awt.geom.Area;` would be invalid with Eclipse as well. – CommonsWare Apr 21 '16 at 12:49
  • it used to work but it is an app that i have not compiled or run for a couple of years now. since it is dependent on googlemaps api v2, which has since been deprecated, the app does not perform correctly in its current configuration. but thanks, i am attempting to solve the issue with the `android.graphics` library set – tony gil Apr 21 '16 at 13:00
  • please post as an answer and it will be upvoted. i cant guarantee that i will accept as cooreect answer until i have effectively solved the problem. – tony gil Apr 21 '16 at 13:01
  • 1
    this answer...... http://stackoverflow.com/a/13189376/3678308 – Muhammad Waleed Apr 21 '16 at 13:25
  • @ExceptionLover post as answer and you will get UPVOTED. tks. – tony gil Apr 21 '16 at 13:29

1 Answers1

4

@CommonsWare suggested that i not use java.awt library and that is probably sound longterm advice.

On the other hand, to solve the problem at hand, i downloaded the library, unzipped the file and placed the jar file (java-rt-jar-stubs-1.5.0.jar) in libs folder.

I then right-clicked on the jar file and chose Add as library.

Problem solved.

tony gil
  • 9,424
  • 6
  • 76
  • 100