Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while porting app from Eclipse to Android Studio

I am in the process of porting a project from Eclipse to the latest Android Studio. All went fine by copying all the files in the directory used by AS but I get a host of errors practically on all the libraries I use and the imports from my own project: what may be the problem? This is the list of errors: (of course the unfound symbols are fine and kicking in the project).

/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/LoginActivity.java
Error:(10, 30) error: package com.google.android.gcm does not exist
Error:(29, 73) error: interface expected here
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/NearStatus.java
Error:(8, 33) error: cannot find symbol class BookingStatus
Error:(8, 58) error: cannot find symbol class UrlConnectionDelegate
Error:(10, 17) error: cannot find symbol class BookingStatus
Error:(11, 2) error: cannot find symbol class Dashboard
Error:(13, 16) error: cannot find symbol class BookingStatus
Error:(23, 12) error: cannot find symbol class BookingStatus
Error:(44, 12) error: cannot find symbol class Status
Error:(48, 2) error: cannot find symbol class BookingStatus
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/Reservation.java
Error:(38, 37) error: cannot find symbol class UrlConnectionDelegate
Error:(70, 10) error: cannot find symbol class Status
Error:(87, 9) error: cannot find symbol class Status
Error:(91, 31) error: cannot find symbol class Status
Error:(94, 2) error: cannot find symbol class Line
Error:(95, 2) error: cannot find symbol class Line
Error:(97, 13) error: cannot find symbol class SimpleGeofence
Error:(101, 13) error: cannot find symbol class SimpleGeofenceStore
Error:(343, 2) error: cannot find symbol class Status
Error:(366, 18) error: cannot find symbol class Status
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/ReservationManager.java
Error:(6, 9) error: cannot find symbol class Reservation
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/RunningStatus.java
Error:(18, 3) error: interface expected here
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/ServerUtilities.java
Error:(14, 43) error: cannot find symbol class CommonUtilities
Error:(14, 1) error: static import only from classes and interfaces
Error:(15, 43) error: cannot find symbol class CommonUtilities
Error:(15, 1) error: static import only from classes and interfaces
Error:(16, 43) error: cannot find symbol class CommonUtilities
Error:(16, 1) error: static import only from classes and interfaces
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/Taximeter.java
Error:(27, 62) error: interface expected here
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/AccountInformation.java
Error:(12, 58) error: interface expected here
Error:(182, 24) error: incompatible types: AccountInformation cannot be converted to UrlConnectionDelegate
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/BackgroundLocationService.java
Error:(42, 67) error: interface expected here
Error:(118, 22) error: incompatible types: BackgroundLocationService cannot be converted to UrlConnectionDelegate
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/DashboardActivity.java
Error:(5, 46) error: package com.example.taxiprofessional.Taximeter does not exist
Error:(45, 34) error: interface expected here
Error:(427, 3) error: cannot find symbol class Reservation
Error:(440, 4) error: cannot find symbol class Reservation
Error:(440, 34) error: cannot find symbol class Reservation
Error:(455, 22) error: incompatible types: DashboardActivity cannot be converted to UrlConnectionDelegate
Error:(462, 3) error: cannot find symbol class Reservation
Error:(462, 33) error: cannot find symbol class Reservation
Error:(487, 21) error: incompatible types: DashboardActivity cannot be converted to UrlConnectionDelegate
Error:(522, 3) error: cannot find symbol class Reservation
Error:(622, 2) error: method does not override or implement a method from a supertype
Error:(628, 2) error: method does not override or implement a method from a supertype
Error:(683, 66) error: cannot find symbol variable NearStatus
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/PollService.java
Error:(29, 53) error: interface expected here
Error:(60, 48) error: cannot find symbol class Dashboard
Error:(106, 27) error: incompatible types: PollService cannot be converted to UrlConnectionDelegate
Error:(101, 15) error: package Dashboard does not exist
Error:(123, 30) error: cannot find symbol variable Dashboard
Error:(130, 51) error: cannot find symbol class Dashboard
Error:(140, 21) error: package NotificationCompat does not exist
Error:(140, 62) error: package NotificationCompat does not exist
Error:(189, 64) error: cannot find symbol class Reservation
Error:(246, 69) error: cannot find symbol variable NearStatus
Error:(217, 14) error: package Dashboard does not exist
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/Line.java
Error:(117, 50) error: cannot find symbol variable Dashboard
Error:(143, 29) error: package Dashboard.dashboard does not exist
Error:(146, 28) error: package Dashboard.dashboard does not exist
Error:(161, 47) error: package Dashboard.dashboard does not exist
Error:(220, 34) error: package Dashboard does not exist
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/BusyStatus.java
Error:(12, 58) error: interface expected here
Error:(15, 2) error: cannot find symbol class Dashboard
Error:(15, 21) error: cannot find symbol variable Dashboard
Error:(39, 22) error: incompatible types: BusyStatus cannot be converted to UrlConnectionDelegate
Error:(93, 32) error: package Dashboard does not exist
Error:(85, 58) error: cannot find symbol variable Dashboard
Error:(86, 33) error: package Dashboard does not exist
Error:(106, 21) error: package Dashboard does not exist
Error:(106, 65) error: package Dashboard does not exist
Error:(110, 37) error: package Dashboard does not exist
Error:(119, 37) error: package Dashboard does not exist
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/ConfirmedLocalStatus.java
Error:(10, 3) error: cannot find symbol class Dashboard
Error:(10, 22) error: cannot find symbol variable Dashboard
Error:(43, 60) error: cannot find symbol variable NearStatus
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/ConfirmedRemoteStatus.java
Error:(9, 2) error: cannot find symbol class Dashboard
Error:(9, 21) error: cannot find symbol variable Dashboard
Error:(35, 3) error: cannot find symbol class Reservation
Error:(73, 59) error: cannot find symbol variable NearStatus
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/FreeStatus.java
Error:(7, 58) error: interface expected here
Error:(10, 2) error: cannot find symbol class Dashboard
Error:(10, 21) error: cannot find symbol variable Dashboard
Error:(39, 22) error: incompatible types: FreeStatus cannot be converted to UrlConnectionDelegate
/Users/fbartolom/Documents/Android/TaxiProfessional/app/src/main/java/info.inarrivo.taxiprofessional/GCMIntentService.java
Error:(11, 43) error: cannot find symbol class CommonUtilities
Error:(11, 1) error: static import only from classes and interfaces
Error:(12, 43) error: cannot find symbol class CommonUtilities
Error:(12, 1) error: static import only from classes and interfaces
Error:(14, 39) error: cannot find symbol class GCMBaseIntentService
Error:(19, 12) error: cannot find symbol variable SENDER_ID
Error:(25, 2) error: method does not override or implement a method from a supertype
Error:(28, 6) error: cannot find symbol method displayMessage(Context,String)
Error:(36, 2) error: method does not override or implement a method from a supertype
Error:(39, 30) error: cannot find symbol method getString(int)
Error:(46, 2) error: method does not override or implement a method from a supertype
Error:(51, 6) error: cannot find symbol method displayMessage(Context,String)
Error:(59, 2) error: method does not override or implement a method from a supertype
Error:(62, 23) error: cannot find symbol method getString(int,int)
Error:(63, 6) error: cannot find symbol method displayMessage(Context,String)

and this is my updated build.gradle file still not compiling:

buildscript {

dependencies {
    classpath 'com.android.tools.build:gradle:0.11.1'
}
}

apply plugin: 'android'
dependencies {
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.google.android.gms:play-services:4.2.42'
    compile 'org.apache.commons:commons-lang3:3.2.+'
}
android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"
    defaultConfig {
    minSdkVersion 19
    targetSdkVersion 19
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

}

and this one is the file apparently created by Android Studio autonomously:

apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "20.0.0"
defaultConfig {
    applicationId 'com.inarrivo.info.taxiprofessional'
    minSdkVersion 15
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:support-v13:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:gridlayout-v7:20.0.0'
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.google.code.gson:gson:2.2.4'
}

with no benefit either.

like image 417
Fabrizio Bartolomucci Avatar asked Feb 12 '23 01:02

Fabrizio Bartolomucci


1 Answers

You'll have to re-add all your dependencies, including appcompat.

If you have all the jars, you can put them in the libs/ directory of the app when using a dependency like this in the app's build.gradle (projectdir/app/build.gradle):

compile fileTree(dir: 'libs', include: ['*.jar'])

The other and preferred option is to declare dependencies in Maven-coordinates, like below (excerpt from the app's build.gradle file):

dependencies {
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.google.android.gms:play-services:4.2.42'
    compile 'org.apache.commons:commons-lang3:3.2.+'
}
like image 160
Per Christian Henden Avatar answered Feb 14 '23 15:02

Per Christian Henden