Giter Site home page Giter Site logo

Comments (18)

npurushe avatar npurushe commented on May 7, 2024

Hi you need to add the annotation processor into your build script. For gradle something like this:

apt 'io.requery:requery-processor:1.0-SNAPSHOT' 

Where apt scope comes from a plugin. For android you can use

buildscript {
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

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

For regular java

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "net.ltgt.gradle:gradle-apt-plugin:0.5"
    }
}

apply plugin: `net.ltgt.apt`

from requery.

oleonov avatar oleonov commented on May 7, 2024

Hi! I have this lines in my build.gradle.

My build.gradle is

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        // replace with the current version of the Android plugin
        classpath 'com.android.tools.build:gradle:1.5.0'
        // the latest version of the android-apt plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

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


repositories {
    jcenter()
    maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    dataBinding {
        enabled = true
    }

    defaultConfig {
        applicationId "com.pandorika.requry.requerytest"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.databinding:library:1.0-rc5'
    compile 'com.android.databinding:adapters:1.0-rc5'
    compile 'io.reactivex:rxjava:1.1.0'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'io.requery:requery:1.0-SNAPSHOT'
    compile 'io.requery:requery-android:1.0-SNAPSHOT' // for android
    apt 'io.requery:requery-processor:1.0-SNAPSHOT'   // prefer an APT plugin
}

from requery.

npurushe avatar npurushe commented on May 7, 2024

Yup that looks correct. Are you using Android Studio 2.0? Make sure you have the latest beta version 6 there are some known issues with the previous builds and annotation processors. If not or you have the latest version, if you run gradle build any errors from the compiler?

from requery.

oleonov avatar oleonov commented on May 7, 2024

I am using Android Studio 1.5.1. Does the library will work only on 2.0?

Errors showed using ./gradlew build Lint found 7 errors http://joxi.ru/nAynnP9IX41e1r

from requery.

npurushe avatar npurushe commented on May 7, 2024

It works on Android 1.5.1. Have you enabled strict lint options anywhere? normally those shouldn't affect your build. Those lint errors can be ignored because those classes would never be loaded while running under Android see https://code.google.com/p/android/issues/detail?id=65867 you can change that like this

lintOptions {
   warning 'InvalidPackage'
}

in the android section of your build.

from requery.

oleonov avatar oleonov commented on May 7, 2024

I do not enable strict mode. Now I add lintOptions and get no errors, but when I run app, using Android Studio:
03-06 22:48:20.749 9103-9103/com.pandorika.requry.requerytest E/AndroidRuntime: FATAL EXCEPTION: main Process: com.pandorika.requry.requerytest, PID: 9103 java.lang.RuntimeException: Unable to instantiate application com.pandorika.requry.requerytest.PeopleApplication: java.lang.ClassNotFoundException: Didn't find class "com.pandorika.requry.requerytest.PeopleApplication" on path: DexPathList[[zip file "/data/app/com.pandorika.requry.requerytest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.pandorika.requry.requerytest-1/lib/arm64, /vendor/lib64, /system/lib64]] at android.app.LoadedApk.makeApplication(LoadedApk.java:578) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680) at android.app.ActivityThread.-wrap1(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.pandorika.requry.requerytest.PeopleApplication" on path: DexPathList[[zip file "/data/app/com.pandorika.requry.requerytest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.pandorika.requry.requerytest-1/lib/arm64, /vendor/lib64, /system/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.Instrumentation.newApplication(Instrumentation.java:981) at android.app.LoadedApk.makeApplication(LoadedApk.java:573) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680)  at android.app.ActivityThread.-wrap1(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  Suppressed: java.lang.ClassNotFoundException: com.pandorika.requry.requerytest.PeopleApplication at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 12 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

What can I do to solve this problem?
PersonEntity stills highlighted red(and other *Entity classes)

from requery.

npurushe avatar npurushe commented on May 7, 2024

I think you're almost there :) Did you copy PeopleApplication from the example into your project? Looks like that class is missing.

from requery.

oleonov avatar oleonov commented on May 7, 2024

Yes, I copy PeopleApplication without changes and add it to AndroidManifest.xml
http://pastebin.com/Er9fhZeT
http://pastebin.com/UipuGAtM

from requery.

npurushe avatar npurushe commented on May 7, 2024

I would try fully qualifying the application class name in your manifest. Looks like it's not matching up somewhere. Also double check all the packages are the same in the manifest and the gradle file. Also might be worth trying a clean/rebuild

from requery.

oleonov avatar oleonov commented on May 7, 2024

I clean project twice and tried full applicaction name inside manifest file - same problem.
Maybe some problem in my java sdk java-7-oracle, but other projects build and run successfully.

from requery.

npurushe avatar npurushe commented on May 7, 2024

I would try this in a terminal run ./gradlew installDebug. Does it build successfully and produce a final apk? What's the gradle output from that. Thanks

from requery.

oleonov avatar oleonov commented on May 7, 2024

`....
:app:installDebug
Installing APK 'app-debug.apk' on 'Nexus 5X - 6.0.1' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 19.237 secs`
And same problem when run.

from requery.

npurushe avatar npurushe commented on May 7, 2024

Are you willing to share the apk? I can try to run it and find the problem

from requery.

oleonov avatar oleonov commented on May 7, 2024

APK https://drive.google.com/file/d/0Bz5ubjgyZtbEek42aU5LY05XY1E/view?usp=sharing
Sources https://drive.google.com/file/d/0Bz5ubjgyZtbEYzJUR2huVVpMemc/view?usp=sharing

from requery.

npurushe avatar npurushe commented on May 7, 2024

Hey there had a look and there were a couple of issues. The databinding plugin has to be applied in the main script. Also some databinding references were not updated with your changed package name, these things that need to be changed manually when databinding is involved since it is a new feature in Android Studio. I attached the fixed version.
ReQueryTest.zip

from requery.

oleonov avatar oleonov commented on May 7, 2024

Thank you! I will discover changes)

from requery.

npurushe avatar npurushe commented on May 7, 2024

Sure, working with databinding is still a bit tricky on Android since its still a new thing. I will also probably create a simpler example that doesn't use it for simplicity.

from requery.

oleonov avatar oleonov commented on May 7, 2024

Yes, simple project without binding will be more understandable)

from requery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.