I am a beginner for Android Cloud Endpoints. I am trying to create a backend module in Android Studio 1.0 RC2. Everything seems okay while creating a backend endpoint module (https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints). The gradle builds successfully. But when I wanted to debug locally, I found the problem. It said, "App Engine Gradle configuration not detected on module, maybe you need to Sync Project with Gradle".
I tried to rebuild the whole project, it builds successfully. But the error remains.
This is the screenshot: https://www.dropbox.com/s/tvuv52ldmr0yzvs/Screen%20Shot%202014-11-27%20at%204.21.14%20pm.png?dl=0
Thank a lot.
This was a recently introduced bug that has since been fixed in Android Studio 1.0.
I am not sure if it is the solution. But this is what I did. I created another new project (the problem happened in existing project that I migrated from Android Studio 0.8.9 to 1.0 RC2. I added new module for Google Cloud EndPoints. Initially it was same problem (there is same error in debug config as above, although it can build the whole project successfully.) But after I changed the build.gradle file in backend module to gradle-appengine-plugin:1.9.17 (latest), the new project backend was okay.
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.17'
}
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.17'
compile 'com.google.appengine:appengine-endpoints:1.9.17'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.17'
compile 'javax.servlet:servlet-api:2.5' }
I tried to change the build.gradle file in my migrated projects, but still failed. So, what I did was copy the content from new project
backend.iml
file into my migrated project backend.iml. And it works.
Related
I'm a bit new to the Gradle build system. My app already had some working integrations with Google Play Services, including the Ads library. I'm trying to add the Android Nearby service to my build.gradle, but the import for the ads library no longer works specifically after I added in the Nearby library.
In my build.gradle:
dependency {
implementation "com.google.android.gms:play-services-nearby:$rootProject.ext.playServicesLibraryVersion"
}
playServicesLibraryVersion is 15.0.1, which is the latest. The project builds successfully, but the errors arise specifically when I'm deploying to target. My target device is running Android P and I'm using Android Studio 3.1.2.
If I add implementation "com.google.android.gms:play-services-ads:$rootProject.ext.playServicesLibraryVersion" I get a Multiple Dex error.
Any ideas?
Update: issue was resolved when I did a clean build, invalidated cache, and used api instead of implementation in the build.gradle. I added both libraries to my dependencies.
I have an issue that dependencies of a project that is referenced as a dependency module in my android app seem not to be included into the .apk file of my android application.
Project Setup
Android App (Android studio & gradle)
Java desktop application (IntelliJ/maven/gradle project)
Java model (classes & features used by both android & desktop app)
The "Java model" is added as a dependency to both Android App and Java Desktop application.
When I run the desktop application, the dependencies of the JavaModel are resolved via maven, incuded into the application and everything runs smoothly.
From an Android Studio point of view, I have imported the JavaModel as a module into the android project and gradle is used to resolve the dependencies. I have set up the following gradle files:
Android App "settings.gradle"
include ':app'
include ':JavaModel'
project(':JavaModel').projectDir=new File('../../JavaModel')
Android App "build.gradle"
dependencies {
compile project(':JavaModel')
// and more...
}
Java Model "build.gradle"
dependencies {
compile(
'org.apache.httpcomponents:httpclient:4.4.1'
// and more ...
)
}
Everything compiles just fine without any errors and a .apk can be created and runs on my test device. However, as soon as I access features within the app that are provided by the "Java model" (in this example, I am using the HttpClient class from the org.apache.httpcomponents:httpclient:4.4.1 dependency), I get the following exception:
java.lang.ClassNotFoundException: Didn't find class
"org.apache.http.impl.client.HttpClients"
Plese note that this is just an example case and the issue also occurs with all other dependencies that are only referenced in the "JavaModel", but not in the Android app itself.
It seems to me like the dependencies of the "JavaModel" work just fine at compile time, since everything executes just fine, but are then not included into the .apk file and therefore cause this exeption.
The question is how can I (correctly) make sure that even dependencies of a dependency project are included into the .apk file?
Apache http client conflicts with android one, if you want to use recent one, you need to use android port https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html
Regarding "JavaModel". If dependencies of JavaModel are compile dependencies it all must work fine (assuming dependency does not have fancy code like classloaders)
I'm new to Android Studio and i want to implement Urban Airship in one of my projects. I followed the example on their website with the .aar file and I ended up getting this error.
Error: [/Users/AndroidstudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.urbanairship/urbanairship-lib/5.1.0/AndroidManifest.xml:8]
Invalid instruction 'overrideLibrary', valid instructions are : REMOVE,REPLACE,STRICT
Correct me if I'm wrong but doesn't this mean that they have issues in their manifest file? Or am I completely out in the blue? If so, do anyone have a good example on how to implement it?
The Urban Airship SDK builds against Google Play Services that requires Android API 9, while Urban Airship is compatible with 6+. That is why we need the override library version. What android gradle plugin version are you using? You need to use 13.3 or greater. See http://tools.android.com/tech-docs/new-build-system.
In the projects build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}
}
I just had the same problem, and was able to fix it and build my project:
The offending line is line 8 of the AndroidManifest.xml
I just removed this line and changed some SDK versions.
You can open the file urbanairship-lib-5.1.0.aar using WinRar.
Navigate to the Manifest. Open it and edit within your favourite text editor.
Save and close the manifest. WinRar asks if you want to update the archive. Choose Yes!
According to this page, overrideLibrary is used for when you have minSDK version in a library > minSDK version in your project. So it allows a different version to be compiled instead, without errors.
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-tools:overrideLibrary-marker
Remove, replace etc do something a bit different (also described on that page - scroll up).
Then in my projects build.gradle file I changed the version numbers to match my project:
From this
compile 'com.android.support:support-v4:21.+'
To this
compile 'com.android.support:support-v4:19.+'
Would be good to know what's the outcome of the OP's support ticket. Please keep us posted!
I ran into this issue as well evaluating the 5.1.0 version of the Urban Airship SDK. I am using Android Studio Beta 0.8.14. I contacted Urban Airship support and they told me to increment the version of gradle to 0.13.3. Android Studio 0.8.14 is defaulting to 0.13.2. After changing the version of gradle to 0.13.3 in the project build.gradle file I was able to successfully compile and import the new SDK.
I'm trying to implement a Facebook Like Button in an app and I just found a good library: Facebook Like Button by shamanland.
Now the problem is that I'm using Eclipse and I can't figure out how to import this project correctly in order to use it in the app.
Can anyone help?
Thanks!
That project uses the gradle build system, but eclipse uses the ant system.
Google is leaving ant and migrating to the new gradle system which is used with their new Android Studio IDE. Most of the new libraries also are migrating to gradle due to easy dependency management.
This is a good time to migrate your project to Android Studio.
Download it and when you import your project, it will automatically convert it to gradle.
Then you can easily add gradle libraries to your project's build.gradle, and it will take care of downloading and maintaining them.
For this particular library, you have to add the following to your build.gradle:
repositories {
mavenCentral()
}
dependencies {
compile 'com.shamanland:facebook-like-button:0.1.6'
}
You can also download the Gradle plugin for Eclipse, but it may not be fully compatible with ADT. It's better to use the Android Studio and avoid the headache.
More Info Here
You may download compiled aar file from the Maven Cental.
Just import this aar into your Eclipse project as standalone library.
When I run the installClientLibs from Android Studio (with gradle command as well) for an Endpoint, the jar is generated with this name:
libEndpoint-v1-1.18.0-rc-SNAPSHOT
But since some days ago, it's being generated as:
libEndpoint-v1-1.19.0-SNAPSHOT
Where do the "18.0-rc" and the "19.0" come from? Why did it change? Is it due to a SDK update maybe?
This is the version of the Google libraries:
google-api-client-1.18.0-rc
google-api-client-android-1.18.0-rc
google-http-client-1.18.0-rc
google-http-client-android-1.18.0-rc
google-oauth-client-1.18.0-rc
These libraries are used to generate android client library for your Android module.
You can see them if you expand External Libraries section in Android Studio.
You can also check what is the latest version in Maven Repository. Just go to http://search.maven.org/ and type one of them. You will notice that 1.19.0 is the newest one as you posted.
If you would like avoid update Android module gradle file every time version changes, you can set your dependency like this:
compile project(path: ':backend', configuration: 'android-endpoints')
where backend is the name of the module. By the way, this is how Google Cloud Endpoint template generates configuration for a while. If you find any difficulties applying this way, try creating new project and generate backend module.