错误:程序包不存在android google mobile后端启动器
这里有一些类似的问题,但我很难找到解决方案 我正在使用google mobile backend starter,在我想尝试从gcminentService.java发送通知之前,一切正常。如果我打电话错误:程序包不存在android google mobile后端启动器,android,google-app-engine,android-gradle-plugin,Android,Google App Engine,Android Gradle Plugin,这里有一些类似的问题,但我很难找到解决方案 我正在使用google mobile backend starter,在我想尝试从gcminentService.java发送通知之前,一切正常。如果我打电话 Intent resultIntent = new Intent(this, MyActivity.class); 我得到一个错误,应用程序模块中的MyActivity不存在。我很确定我应该加上 compile project(':app') 对于保存gcminentservice.java
Intent resultIntent = new Intent(this, MyActivity.class);
我得到一个错误,应用程序模块中的MyActivity不存在。我很确定我应该加上
compile project(':app')
对于保存gcminentservice.java的核心模块的渐变依赖性,但如果我这样做,我会得到一个错误,说应用程序不是库
这是核心模块gradle dependencies
dependencies {
compile('com.google.cloud.backend:mobilebackend:v1-1.19.0-SNAPSHOT') {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.api-client:google-api-client-android:1.19.0'
compile 'com.google.http-client:google-http-client:1.19.0'
compile('com.google.http-client:google-http-client-android:1.19.0') {
exclude(group: 'com.google.android', module: 'android')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile 'com.google.http-client:google-http-client-gson:1.19.0'
compile 'com.google.http-client:google-http-client-jackson:1.19.0'
compile 'com.google.http-client:google-http-client-jackson2:1.19.0'
compile 'com.google.oauth-client:google-oauth-client:1.19.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.fasterxml.jackson.core:jackson-core:2.1.3'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.mcxiaoke.volley:library:1.0.+@aar'
compile 'com.google.android.gms:play-services:4.4.52'
}
如果你的
app
项目不是一个库(如果它使用apply插件:“com.android.application”
而不是apply插件:“com.android.library”
),那么其他模块就不能依赖它。您只能依赖于库,而不能依赖于应用程序模块
您可能需要将所有东西都依赖的通用代码分解成一个单独的模块,您的核心模块和应用程序模块都可以依赖该模块。谢谢。我无法移动公共代码,因为我只想从后端库调用一个应用程序活动(如您所想,
apply plugin:'com.android.application'
)。有没有办法从库中调用应用程序模块活动意图?后端库模块处理应用程序的所有消息传递,我也希望从这里生成一个带有意图的通知。也许这需要一个全新的问题。我已将你的答案标记为正确,因为它回答了我关于错误的原始问题。另一个问题是如何解决。您应该能够从一个库中激发一个意图——意图的耦合是非常松散的,如果您能够很好地构造它,您将不会遇到很多库依赖性问题。