2

何が起こったのかよく分かりませんが、gradle 3.0.0 rc2に移動した後、私のアプリケーションモジュールはエンドポイントモジュールによって生成されたクライアントライブラリを認識しません。エンドポイントクライアントライブラリが認識されない

ビルドでは1つの例外を除いて問題は発生しません。新しいAPIはビルドでは選択されません。ここで

は私のアプリモジュール内のGradleファイルの依存関係のセクションです:

dependencies { 
// Gradle dependency check...must be run in the project directory 
// ./gradlew -q dependencies app:dependencies --configuration compile 

implementation fileTree(include: ['*.jar'], dir: 'libs') 
implementation project(path: ':backend', configuration: 'android-endpoints') 

アップデート:私は戦争/ jarファイルが一貫バックエンドで更新されていることに気づい

/構築/ zipファイルもバックエンド/ビルド/クライアント-libsで更新されます。

更新#2:

これは、Android Studioの3.0で発生します。

更新#3: どうやら、これは3.0 RC2に既知のバグですhere

アップデート#4 はここで何をGoogleチームの提案だが、私は考え、それが動作するようになってを持っていない参照してください。誰でも?

//In library module: 

dependencies { 
    api fileTree(include: ['*.jar'], dir: 'libs') 
} 

のGradleファイル参照:

プロジェクトレベル:

buildscript { 
repositories { 
    jcenter() 
    google() 
} 
dependencies { 

    // 2.0 
    classpath 'com.google.guava:guava:22.0' 
    classpath 'com.android.tools.build:gradle:3.0.0' 

    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
} 
} 

allprojects { 
repositories { 
    jcenter() 
} 
} 

task clean(type: Delete) { 
delete rootProject.buildDir 
} 

エンドポイント(バックエンド)レベル:

buildscript { 
repositories { 
    mavenCentral() 
    jcenter() 

} 
dependencies { 
    // V2: Add the new App Engine and Endpoints Frameworks plugin dependencies 
    classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2' 
    classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3' 

} 
} 

repositories { 
mavenCentral() 
jcenter() 
} 

apply plugin: 'java' 
apply plugin: 'war' 

// V2: Apply new App Engine and Endpoints Framework server plugins 
apply plugin: 'com.google.cloud.tools.appengine' 
apply plugin: 'com.google.cloud.tools.endpoints-framework-server' 

sourceCompatibility = JavaVersion.VERSION_1_8 
targetCompatibility = JavaVersion.VERSION_1_8 

dependencies { 
// V2: Endpoints Framework v2 migration 
implementation 'com.google.endpoints:endpoints-framework:2.0.8' 

testImplementation 'junit:junit:4.12' 
testImplementation 'com.google.appengine:appengine-testing:1.9.59' 
testImplementation 'com.google.appengine:appengine-api-stubs:1.9.59' 

// 2.0 
//implementation group: 'com.google.endpoints', name: 'endpoints-framework', version: '+' 

implementation group: 'com.googlecode.junit-toolbox', name: 'junit-toolbox', version: '1.5' 

implementation 'com.googlecode.objectify:objectify:5.1.21' 
implementation 'org.json:json:20151123' 
implementation 'javax.servlet:servlet-api:2.5' 
implementation 'org.apache.httpcomponents:httpclient:4.5.2' 
implementation 'com.ganyo:gcm-server:1.0.2' 
implementation 'com.google.appengine.tools:appengine-gcs-client:0.4.4' 
implementation 'com.google.apis:google-api-services-storage:v1-rev66-1.21.0' 
implementation 'com.google.api-client:google-api-client:1.23.0' 
implementation 'com.google.http-client:google-http-client-android:1.23.0' 

// I think this can be deleted 
//implementation 'commons-fileupload:commons-fileupload:1.3.1' 


} 

appengine { 
// All commented out due to v2 
//downloadSdk = true 
/*appcfg { 
    oauth2 = true 
}*/ 
/*endpoints { 
    getClientLibsOnBuild = true 
    getDiscoveryDocsOnBuild = true 
    googleClientVersion = '1.23.0' 
}*/ 

//httpAddress = "0.0.0.0" 


} 

// 2.0 - optional 
endpointsServer { 
// Endpoints Framework Plugin server-side configuration 
hostname = "mickey-mouse-pooh.appspot.com" 
} 

アプリケーションレベル:

apply plugin: 'com.android.application' 

// V2: Apply the new Endpoints Framework client plugin 
apply plugin: 'com.google.cloud.tools.endpoints-framework-client' 

buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    // V2: Add the new Endpoints Framework plugin dependencies 
    classpath 'com.google.cloud.tools:endpoints-framework-gradle- 
plugin:1.0.2' 
} 
} 

android { 
compileSdkVersion 26 
buildToolsVersion '26.0.2' 
defaultConfig { 
    applicationId "com.inneraries.projectboon" 
    minSdkVersion 20 // before to update 
    targetSdkVersion 26 
    android.compileOptions.sourceCompatibility 1.8 
    android.compileOptions.targetCompatibility 1.8 
    versionCode 112 
    versionName 'Phoenix' 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
productFlavors { 

} 
compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
} 
} 

repositories { 
jcenter() 
maven { 
    url "https://maven.google.com" 
} 
} 

dependencies { 
// Gradle dependency check...must be run in the project directory 
// ./gradlew -q dependencies app:dependencies --configuration compile 
implementation fileTree(include: ['*.jar'], dir: 'libs') 

// V2 
endpointsServer project(path: ':backend', configuration: 'endpoints') 

// the "force" element is in place to avoid the conflict from the Facebook SDK 4.36.0 which is 
// using 25.3.1 Android SDK 
api('com.android.support:appcompat-v7:26.1.0') { 
    force = true 
} 
api('com.android.support:design:26.1.0') { 
    force = true 
} 
// For enabling Google app invite 
api 'com.google.firebase:firebase-invites:11.4.2' 

api 'com.google.android.gms:play-services-plus:11.4.2' 
api 'com.google.android.gms:play-services-auth:11.4.2' 
api 'com.google.android.gms:play-services-identity:11.4.2' 
api 'com.google.android.gms:play-services-location:11.4.2' 
api 'com.google.android.gms:play-services-gcm:11.4.2' 
api 'com.facebook.android:facebook-android-sdk:4.27.0' 

api 'com.google.api-client:google-api-client:1.23.0' 
api 'com.google.http-client:google-http-client-android:1.23.0' 
} 

// this is to avoid this error 
// Warning:Conflict with dependency 'com.google.code.findbugs:jsr305'. 
// Resolved versions for app (1.3.9) and test app (2.0.1) differ. 
configurations.all { 
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' 
} 
+0

Googleから推定された解決日がありますか?私はこれがgradle syncの問題であることを確認しました。 – m121212

+0

まだありませんが、最新のアップデートを入手するたびにこの投稿を更新していきます。問題へのリンクも共有していますので、自分自身を監視したい場合は無料でご利用ください。 :) –

+1

一時的な修正として、バックエンド/ build/libsからバックエンド-android-endpoints.jarを手動でappモジュールのlibsに追加しています。 –

答えて

1

Googleのスタンドは、2017年11月1日現在:Upgrade the framework to v2です。

彼らはまた、いくつかの回避策(上司がこれを好きではないかもしれません)提供:

  1. が手動でクライアントライブラリを構築し、それを上にコピーします。 [gradleタスクを使用:appengineEndpointsGetClientLibs]
  2. 既成のjarファイルをエクスポートしてコピーします。[利用Gradleのタスク:appengineEndpointsExportClientLibs]注:2と3は、直接、別のメカニズムを使用して新しいプラグインを使用するには、Androidアプリ

  3. しようとすると、しばらくのGoogle-API-クライアント-libの依存関係を追加 にあなたを必要とします私は https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/blob/master/ANDROID_README.md

:ので、あなたが実行して展開するための直接のGradle /コマンドライン ツールを使用する必要があります - それは自動的に、これはAndroidのメーカーのUIで を統合されません、プロジェクトにソースを追加しません私のあなたが参照が必要な場合は、問題の説明にファイルを変換してください。

1

私はこの問題を過去10日間に調査しました。これが私が理解したものです。最初の導入以来Android Studioに統合されているエンドポイント開発に関するGoogleの考え方が変わりました。実際、Android Studio 3はエンドポイントにネイティブサポートを提供しません(実際は、エンドポイントモジュールをもう追加することはできません)。 基本的には、クライアント側の開発からバックエンドの開発(すべてのプラットフォームで一般的)を分離しようとしています。したがって、IntelliJでバックエンドを開発し、生成されたライブラリを 'lib'フォルダ(プロジェクト作成時のデフォルトフォルダ)にインポートすることをお勧めします。 IntelliJ専用のエンドポイント展開ツールも提供しています(https://cloud.google.com/tools/intellij/docs/参照)。

関連する問題