tony gil
tony gil

Reputation: 9564

Android Studio - error: package java.awt.geom does not exist

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?

Upvotes: 0

Views: 6133

Answers (1)

tony gil
tony gil

Reputation: 9564

@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.

Upvotes: 4

Related Questions