Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build successful ,but can't running #12

Closed
pdog18 opened this issue May 21, 2017 · 20 comments
Closed

build successful ,but can't running #12

pdog18 opened this issue May 21, 2017 · 20 comments
Labels

Comments

@pdog18
Copy link

pdog18 commented May 21, 2017

C:\Users\pdog18\Desktop\android-architecture-components-master\BasicSample\app\src\main\java\com\example\android\persistence\db\AppDatabase.java

Error:(31, 17) 警告: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.

AppDatabase

/*
 * Copyright 2017, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.persistence.db;

import android.arch.persistence.room.Database;
import android.arch.persistence.room.RoomDatabase;
import android.arch.persistence.room.TypeConverters;

import com.example.android.persistence.db.dao.CommentDao;
import com.example.android.persistence.db.dao.ProductDao;
import com.example.android.persistence.db.entity.CommentEntity;
import com.example.android.persistence.db.entity.ProductEntity;
import com.example.android.persistence.db.converter.DateConverter;

@Database(entities = {ProductEntity.class, CommentEntity.class}, version = 1)
@TypeConverters(DateConverter.class)
public abstract class AppDatabase extends RoomDatabase {

    static final String DATABASE_NAME = "basic-sample-db";

    public abstract ProductDao productDao();

    public abstract CommentDao commentDao();
}

@imGurpreetSK
Copy link

For me, it also says package com.example.android.persistence.databinding does not exist; cannot find symbol class CommentItemBinding

@wafer-li
Copy link

wafer-li commented May 21, 2017

Try to export the schema by adding this to your app/build.gradle

android {
    ...
    defaultConfig {
        ...
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation":
                             "$projectDir/schemas".toString()]
            }
        }
    }
}

@pdog18
Copy link
Author

pdog18 commented May 21, 2017

@wafer-li 不行啊..加上这个build.gradle不通过

Error:(47, 0) Could not find method javaCompileOptions() for arguments [build_5ysf0fcwfxj8vp2lg0uw45bf1$_run_closure1$_closure8@6b28c7e9] on object of type com.android.build.gradle.AppExtension.
<a href="openFile:C:\Users\pdog18\Desktop\android-architecture-components-master\BasicSample\app\build.gradle">Open File</a>

我试了下clean 然后还是报错,但是项目可以跑起来了

@pdog18
Copy link
Author

pdog18 commented May 21, 2017

@GurpreetSK95 thanks , i see my databinding is always enable;
then i clean the project and run again,unfortunate ,error again ,but app can running on the avd, i don't know why ..it make me stupid

@wafer-li
Copy link

@pdog18 国际场合还是不说中文为好

I have no problem after adding the snippet, maybe you could try File -> Invalidate Cache / Restart.

And make sure you add it at the right place, my build.gradle as follow:

image

@cacard
Copy link

cacard commented May 23, 2017

火钳流明。You know I am using Chinese.

@imGurpreetSK
Copy link

Still doesn't work

@JoseAlcerreca
Copy link
Contributor

Does this only happen in Windows? For me that's just a warning.

@yigit
Copy link
Contributor

yigit commented May 24, 2017

That schema thing is just a warning so cannot be the problem.
Can you try running ./gradlew asDeb --debug from command line and sharing the output?

@danilodequeiroz
Copy link

I'm facing the same problem, just did what @yigit said, follow the output:
https://gist.github.com/dzfacts/0a02723bce4f42d0fa7bf15d375dce11

@teaphy
Copy link

teaphy commented Jun 8, 2017

I think we can try, speak English by Chinese!!!

@liuwenping828
Copy link

Error:Execution failed for task ':app:transformJackWithJackForDebug'.

java.lang.AssertionError: No yet implemented

@kaikaifly
Copy link

@liuwenping828 do you solve this problem? 你解决了这个问题没

@yunshuipiao
Copy link

image
i have no problem after add it. I use mac os and i do not know the situation on windows.
code happy.

@blaZ3
Copy link

blaZ3 commented Jul 23, 2017

I am also getting the databinding classes not found after adding the this line
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha5"

@blaZ3
Copy link

blaZ3 commented Jul 23, 2017

@GurpreetSK95 were you able to solve this? I am also having the same issue with databinding after adding the room annotation processor

1 similar comment
@zhan2046
Copy link

zhan2046 commented Aug 4, 2017

@GurpreetSK95 were you able to solve this? I am also having the same issue with databinding after adding the room annotation processor

@dewoch971
Copy link

Someone found a solution? I also have the same issue

@firekesti
Copy link

This helped me: https://movieos.org/2017/android-room-data-binding-compile-time-errors/

I was seeing a max of 100 databinding errors, with no "real" error message. By expanding the number of messages that can be shown, check the last error and it will be a real Room compilation error! So, hopefully you can fix that error and get compilation working again :)

allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xmaxerrs" << "4000"
            options.compilerArgs << "-Xmaxwarns" << "4000"
        }
    }
}

@xrnd
Copy link

xrnd commented Jan 19, 2018

I had similar issue after adding Room in my existing application. BR errors hide the actual error in the code. I took steps below and could see the java error and once they were solved, my code worked perfectly fine

For Project gradle
Gradle Plugin Version classpath 'com.android.tools.build:gradle:3.0.1'
and Gradle verison gradle-4.1-all.zip

For app gradle
For Data binding in app.gradle

dataBinding {
       enabled = true
       version '2.3.0'
   }

App dependencies for Room
implementation 'android.arch.persistence.room:runtime:1.0.0'
No Dependency for Data binding and other architectural components as of now

allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xmaxerrs" << "5000"
        }
    }
}

defaultConfig{
  javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
}

After syncing my code I could actually see the Room errors instead of BR errors. The culprit was annotationProcessor 'android.arch.persistence.room:compiler:1.0.0' in app.gradle dependency.
Hope this helps someone

UPDATE:

To Run I the code fine, I had to Rebuild the project and could see room related errors then only. Check my answer https://stackoverflow.com/questions/48356496/room-annotation-processor-with-data-binding/48379815#48379815

@pdog18 pdog18 closed this as completed Aug 24, 2019
recker115 pushed a commit to recker115/architecture-components-samples that referenced this issue Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests