memtrip / SQLKing

SQLKing is an Android SQLite ORM powered by an annotation preprocessor, tables are defined by Table annotations and CRUD classes expose an expressive api for executing SQLite queries. @memtrip
Other
21 stars 9 forks source link

Error:(3, 35) error: package javax.annotation.processing does not exist #2

Closed Trellian closed 8 years ago

Trellian commented 8 years ago

Hi,

Any idea why I might be getting this error at line:

"import javax.annotation.processing.Filer;"

in the com.memtrip.sqlking.preprocessor.processor.validation.context package?

I've recently had to reinstall AS 2.1, perhaps that has something to do with it?

Many thanks, Adrian

samkirton commented 8 years ago

Could you post the full stack trace? javax.annotation.processing.Filer could potentially be in conflict with another preprocessor such as dagger1 or butter knife.

Trellian commented 8 years ago

I did have ButterKnife included, as per your sample app. I have now removed it, but the result is the same.

Here is the stack trace:

FAILURE: Build failed with an exception.

BUILD FAILED

I hope this helps.

Trellian commented 8 years ago

image

Trellian commented 8 years ago

and my module build.gradle file:

apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt'

android { compileSdkVersion 23 buildToolsVersion '23.0.3' defaultConfig { applicationId "com.thorburn.sanscan" minSdkVersion 17 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } // dexOptions { // javaMaxHeapSize "4g" //specify the heap size for the dex process // preDexLibraries false // } productFlavors { } }

dependencies { testCompile 'junit:junit:4.12' compile files('libs/gson-2.4.jar') compile 'com.android.support:appcompat-v7:23.3.0' compile 'net.zetetic:android-database-sqlcipher:3.3.1-2' compile 'com.google.android.gms:play-services:8.4.0' compile 'com.android.support:design:23.3.0' compile 'com.android.support:support-v4:23.3.0' compile 'com.neenbedankt.gradle.plugins:android-apt:1.4' compile 'org.glassfish:javax.annotation:10.0-b28' apt 'com.memtrip.sqlking:preprocessor:1.0' compile 'com.memtrip.sqlking:client:1.0' compile 'joda-time:joda-time:2.9.3' // compile 'com.jakewharton:butterknife:8.0.1' // apt 'com.jakewharton:butterknife-compiler:8.0.1' compile 'com.android.support:recyclerview-v7:23.3.0' }

Trellian commented 8 years ago

and my dependency list:

Executing tasks: [androidDependencies]

Configuration on demand is an incubating feature. Incremental java compilation is an incubating feature. :app:androidDependencies debug +--- LOCAL: gson-2.4.jar +--- com.android.support:appcompat-v7:23.3.0 | +--- com.android.support:support-vector-drawable:23.3.0 | | --- com.android.support:support-v4:23.3.0 | | --- LOCAL: internal_impl-23.3.0.jar | +--- com.android.support:animated-vector-drawable:23.3.0 | | --- com.android.support:support-vector-drawable:23.3.0 | | --- com.android.support:support-v4:23.3.0 | | --- LOCAL: internal_impl-23.3.0.jar | --- com.android.support:support-v4:23.3.0 | --- LOCAL: internal_impl-23.3.0.jar +--- net.zetetic:android-database-sqlcipher:3.3.1-2 +--- com.android.support:design:23.3.0 | +--- com.android.support:appcompat-v7:23.3.0 | | +--- com.android.support:support-vector-drawable:23.3.0 | | | --- com.android.support:support-v4:23.3.0 | | | --- LOCAL: internal_impl-23.3.0.jar | | +--- com.android.support:animated-vector-drawable:23.3.0 | | | --- com.android.support:support-vector-drawable:23.3.0 | | | --- com.android.support:support-v4:23.3.0 | | | --- LOCAL: internal_impl-23.3.0.jar | | --- com.android.support:support-v4:23.3.0 | | --- LOCAL: internal_impl-23.3.0.jar | +--- com.android.support:support-v4:23.3.0 | | --- LOCAL: internal_impl-23.3.0.jar | --- com.android.support:recyclerview-v7:23.3.0 | --- com.android.support:support-v4:23.3.0 | --- LOCAL: internal_impl-23.3.0.jar +--- com.android.support:support-v4:23.3.0 | --- LOCAL: internal_impl-23.3.0.jar +--- com.memtrip.sqlking:client:1.0 | --- io.reactivex:rxandroid:1.1.0 +--- com.android.support:recyclerview-v7:23.3.0 | --- com.android.support:support-v4:23.3.0 | --- LOCAL: internal_impl-23.3.0.jar --- com.google.android.gms:play-services-vision:8.4.0 --- com.google.android.gms:play-services-base:8.4.0 --- com.google.android.gms:play-services-basement:8.4.0 --- com.android.support:support-v4:23.3.0 --- LOCAL: internal_impl-23.3.0.jar

samkirton commented 8 years ago

Are you using indexes with your columns? Indexes aren't fully supported at the moment, if you have a requirement I can implement them properly tonight and make a release. Sorry about that.

Trellian commented 8 years ago

No, not at all.

Here is a sample of a table, they all follow the same rules:

package com.thorburn.sanscan.scanDB;

import android.os.Parcel; import android.os.Parcelable;

import com.memtrip.sqlking.common.Column; import com.memtrip.sqlking.common.Table;

@Table public class tblLocationextends ScanTableBaseimplements Parcelable { @Column E_LOCATION_TYPElocation_type; @Column Stringlocation; @Column int radius;// meters @Column int parent_location_fk;

public E_LOCATION_TYPE getLocation_type ()
   {
   return location_type;
   }

public void setLocation_type (E_LOCATION_TYPE location_type)
   {
   this.location_type = location_type;
   }

public String getLocation ()
   {
   return location;
   }

public void setLocation (String location)
   {
   this.location = location;
   }

public int getRadius ()
   {
   return radius;
   }

public void setRadius (int radius)
   {
   this.radius = radius;
   }

public int getParent_location_fk ()
   {
   return parent_location_fk;
   }

public void setParent_location_fk (int parent_location_fk)
   {
   this.parent_location_fk = parent_location_fk;
   }

But the problem is that the compile fails in C:\PROJECTS\SANScan\app\src\main\java\com\memtrip\sqlking\preprocessor\processor\Context.java, at line 3:

import javax.annotation.processing.Filer;

with the following error:

Error:(3, 35) error: package javax.annotation.processing does not exist

I have tried pulling in javax as a library or dependency from several sources, but it doesn't help. I'm running Android Studio 2.1.1, with JDK 1.8.0_74.

Any ideas?

Thanks, Adrian

On 02 Jun 2016 18:11, Samuel Kirton wrote:

Are you using indexes with your columns?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/memtrip/SQLKing/issues/2#issuecomment-223341047, or mute the thread https://github.com/notifications/unsubscribe/ABCOrBxNl7vL7Fbu_YS5bZRahUTism9Cks5qHwCVgaJpZM4IsZT5.

samkirton commented 8 years ago

Hi Adrian,

The library doesn't support Enums at the moment.

Cheers, Sam

Trellian commented 8 years ago

Hi Sam,

I've removed all my enums, and reverted back to 'int' type, but still the same problem. Help!

Thanks, Adrian

Trellian commented 8 years ago

Also, in C:\PROJECTS\Thorburn\projects\SANScan\app\src\main\java\com\memtrip\sqlking\preprocessor\processor\Processor.java, The same errors show (see image below). Which implementation of javax.* code are you using?

image

samkirton commented 8 years ago

I tried to reproduce your bug and it looks like it is caused by the lower case class name, could you use "TblLocationextends" instead of "tblLocationextends" and try again? There is an assumption that Java classes start with a capital. I will add this to the documentation for now and fix the bug in the next release.

samkirton commented 8 years ago

Also, open the preprocessor project using Intellj or run it with mvn clean install

Trellian commented 8 years ago

I just refactored all the tables to start with a capital letter. I'm still getting exactly the same error. Trying the Intellij option now

samkirton commented 8 years ago

Caused by: java.lang.NullPointerException at com.memtrip.sqlking.preprocessor.processor.model.Column.assembleIsIndex(Column.java:60) at com.memtrip.sqlking.preprocessor.processor.model.Column.(Column.java:42) at com.memtrip.sqlking.preprocessor.processor.model.Table.assembleMembers(Table.java:57) at com.memtrip.sqlking.preprocessor.processor.model.Table.(Table.java:37) at com.memtrip.sqlking.preprocessor.processor.model.Data.assembleTables(Data.java:24) at com.memtrip.sqlking.preprocessor.processor.model.Data.(Data.java:16) at com.memtrip.sqlking.preprocessor.processor.Processor.process(Processor.java:40)

Ok I think one of your private member variables is not annotated with @Column? I have fixed the bug and I will deploy a new version to maven central tonight. When working with ORMs its good practise for the model classes to be a pure reflection of the database table, as such, I would not expect there to be members variables that are not be annotated with @Column.

samkirton commented 8 years ago

Fixed in this branch, here: https://github.com/memtrip/SQLKing/blob/bug/null_index/preprocessor/src/main/java/com/memtrip/sqlking/preprocessor/processor/model/Column.java#L58

Trellian commented 8 years ago

Thanks, I'll give it a shot!

Trellian commented 8 years ago

Hi Sam,

Thank you very much for your help so far, I really appreciate it, especially that you find the time to help out so fast.

I re-imported the module, and the "error: package javax.annotation.processing does not exist" is now fixed, so I'm guessing you will want to close this. However, I am now hitting the same problem you found earlier, where one of the private member variables is not annotated with @Column

The reason for this is the following declaration:

public static final Creator<TblLocation> CREATOR = new Creator<TblLocation>()
    {
    @Override
    public TblLocation createFromParcel (Parcel source) {return new TblLocation(source);}

    @Override
    public TblLocation[] newArray (int size) {return new TblLocation[size];}
    };

which is part of the Parcelable management code. It is obviously not meant to be treated as a column.

What are your thoughts on this? And would you like me to open a new issue?

Many thanks, Adrian

samkirton commented 8 years ago

Hi Adrian,

A new issue would be great.

Cheers, Sam