Comments (8)
It looks like gradle is trying to compile before it runs the proto compiler. I suspect it's more complex than this, but my first guess would be to reverse the two plugins at the top of the file:
apply plugin: 'com.google.protobuf'
apply plugin: 'com.android.application'
from java-docs-samples.
Thanks @ricmalta. @qingdaofu1 Can you also take a look at our Android samples which are up now https://github.com/GoogleCloudPlatform/android-docs-samples/tree/master/speech/Speech
from java-docs-samples.
the app build.gradle is
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.amrobotics.googlespeech"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
sourceSets {
main {
proto {
srcDir 'src/main/proto/google/api'
srcDir 'src/main/proto/google/logging'
srcDir 'src/main/proto/google/longrunning'
srcDir 'src/main/proto/google/rpc'
srcDir 'src/main/proto/google/speech'
srcDir 'src/main/proto/google/type'
}
java {
srcDir 'src/main/java'
}
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// compileOptions {
// sourceCompatibility = JavaVersion.VERSION_1_7
// targetCompatibility = JavaVersion.VERSION_1_7
// }
// https://github.com/square/okio/issues/58
lintOptions {
disable 'InvalidPackage', 'HardcodedText'
textReport true
textOutput "stdout"
}
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0-alpha-3'
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:0.15.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
// Javanano is installed by default, but needs to be removed to use protobuf lite..
remove javanano
java {
// Options added to --java_out
option 'lite'
}
}
task.plugins {
grpc {
// Options added to --grpc_out
option 'lite'
}
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'com.android.support:appcompat-v7:24.1.0'
compile 'io.grpc:grpc-netty:0.15.0'
compile 'io.grpc:grpc-protobuf:0.15.0'
compile 'io.grpc:grpc-stub:0.15.0'
compile files('libs/grpc-grpclb-0.14.0.jar')
compile files('libs/grpc-protobuf-nano-0.14.0.jar')
compile files('libs/grpc-benchmarks-0.14.0.jar')
compile files('libs/grpc-interop-testing-0.14.0.jar')
compile files('libs/grpc-examples-0.14.0.jar')
compile files('libs/commons-cli-2.0.jar')
compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2'
compile 'com.google.guava:guava:19.0'
//compile files('libs/commons-cli-1.2.jar')
compile files('libs/google-oauth-client-1.21.0.jar')
compile files('libs/commons-cli-1.3.1.jar')
}
the project build.gradle is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
// mavenCentral()
// maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.7'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
from java-docs-samples.
@jerjou Any ideas here?
from java-docs-samples.
@qingdaofu1 Were you able to try above recommendations?
from java-docs-samples.
@qingdaofu1 have a look to an implementation I did for a simple demo.
I had some problems with the gradle configuration, mainly with a dependency on a legacy version of guava.
Its not bullet proof, but I'm get it working with android
https://github.com/Cloudoki/android-google-cloud-speech-api
from java-docs-samples.
@ricmalta Closing this issue since the link worked for you.
from java-docs-samples.
The solution is to place the following into your build.gradle file:
protobuf { protoc { artifact = "com.google.protobuf:protoc:3.0.0" } plugins { lite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" } } generateProtoTasks { all().each { task -> task.builtins { remove java } task.plugins { lite { } } } } }
from java-docs-samples.
Related Issues (20)
- SubmitJobTest: submitJobTest failed
- InstantiateInlineWorkflowTemplateTest: instanstiateInlineWorkflowTest failed
- SubmitHadoopFsJobTest: submitHadoopFsJobTest failed
- QuickstartTest: quickstartTest failed
- A future improvement would be to properly serialize/deserialize when we write to a real database (not the sharedpreferences, but datastore) HOT 1
- Recommender, Min severity: Info
- Physics
- snippets.healthcare.DicomWebTests: test_DicomWebRetrieveRendered failed HOT 2
- snippets.healthcare.DicomWebTests: test_DicomWebRetrieveStudy failed HOT 2
- snippets.healthcare.DicomWebTests: test_DicomWebSearchInstances failed HOT 2
- snippets.healthcare.DicomWebTests: test_DicomWebSearchStudies failed HOT 2
- snippets.healthcare.DicomWebTests: test_DicomWebStoreInstance failed HOT 2
- snippets.healthcare.DicomWebTests: z_test_DicomWebDeleteStudy failed HOT 2
- com.example.speech.AdaptationCustomClassReferenceV2IT: testCreateCustomClassV2 failed HOT 1
- Payments HOT 1
- com.example.speech.RecognizeIT: testGcsModelSelection failed HOT 3
- compute.custommachinetype.CustomMachineTypeIT: testAddExtendedMemoryToInstance failed HOT 1
- aiplatform.CancelTrainingPipelineSampleTest flaky and failing.
- "displayName": "Access Transparency > Access Transparency > None", "id": "100H44Q1CDHMASRJ41A74OBEEDO62SJ5DPHNI6GJ85HM6PBJECG58SJ1DPPN0OBICLN66U920H76URJ5" }, "displayName": "3rd Test - case - Premium support - Project level case", HOT 1
- LGTM HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-docs-samples.