Android failed to export application (due to google-play-services.jar ) - java

I have problem when trying to sign my application in release mode from over two/three days now. I've tried everything which I find as information in internet/stackoverflow and nothing worked for me.
I did not have problem with building debug version and running on device. The only problem I get is only when I try to sign my application on release mode and I get this error message. “Android library project cannot be exported” and I noticed that this happen when I added “google-play-services.jar” to my project android library for adMob.

Instead of using the Google Play Services jar as dependency, add the Google Play Services library project in your application. Instructions for this can be found at http://developer.android.com/google/play-services/setup.html#Setup

Related

How to debug native react native libraries with Android Studio?

This question is NOT ABOUT how to debug the javascript-land of an React-Native app. It is about how to debug native libraries (means: JAVA-Code in this case) in the node_modules-folder.
While it is very easy for me to debug native iOS-parts of RN-Applications with XCode, i stumbled upon various issues with Android Studio...
The main thing is, that the node_modules-Folder is not present after importing the project into Studio, why it is not possible to setup breakpoints to debug thru.
Versions:
Android Studio 2.2.2 (most recent version currently)
react-native 0.38.0 (latest version also)
gradle 1.3.1 (preconfigured from react-native init)
also tried with upgrade to gradle 2.2.2
Android SDKs and -Build Tools from up to Version 23 installed including NDK
How I did it / Steps to reproduce
1. create new react native project:
react-native init debugTest
2. install third party library with native code that you want to debug natively
cd debugTest &&
react-native install react-native-sqlite-storage
3. ensure that everything would work on android side:
launch GenyMotion
launch an AVD
run the application with this command in terminal:
react-native run-android
(this will open up packager and everything else that is needed to transfer the js-bundle).
If one wants to omit this step, it is necessary to start the packager manually:
node node_modules/react-native/local-cli/cli.js start
4. launch Android Studio
with the upcoming starter dialog, choose "Import Project"
select the directory "android" of your project and click on "import"
(these steps are taken from official RN-documentation):
If you want to use Android Studio to work on native code, from the
Welcome screen of Android Studio choose "Import project" and select
the android folder of your app.
5. Android Studio asks to update gradle version from pre-configured 1.3.2 to 2.2.2. I have first denied it for the whole workflow, later on i tried it out (both did not differ significantly for me)
6. One have to deactivate Instant Run due to this issue
7. Click on "Run" or "Debug" in the Toolbar of Android Studio
So far everything works fine. I was able to set a breakpoint in MainApplication.java::onCreate and could step into this method then.
But here are the questions:
The node_modules-Folder isn't present in Android Studio and can't be debugged this way. How to achieve that?
Debugging the onCreate-Method and going further down into the Java-Stack, very offen it happened that the "Sourcecode does not match the byte code".
The debugger was hanging somewhere else in comments of source code but not on exactly that line, which was selected to execute.
Android SDKs:
I have installed all SDKs and build tools and NDK and everything else since version 23:
TL;DR:
How to debug native libraries that are present in node_modules-Folder of an react native application with Android Studio, because they are not visible in AS thus no breakpoint could be passed?
UPDATE
Finally i've found out the root cause. For me it wasn't working due to the fact, that the library i wanted to debug, wasn't shown in Android Studio. But this was a mistake by myself because the library wasn't setup correctly, why gradle wasn't able to take notice of it.
So, this question can be used like a blog post how to do it right (and will be sufficient if the 3rd party library works out of the box with "rnpm-link" or "react-native link") [which wasn't the case here in my example]
Have you done rnpm link or react-native link ? Once you do that, there will be additional modules along with the app module, something like this.
You can look at all the java code in the native module and put breakdpoints , debug etc.
Bam.... i can answer my first of the two questions now by myself. Thx to #agent_hunt, who put me into the right direction...
In this example application the bindings wasn't setup correctly. "rnpm link" and the newer one "react-native link", which is part of "react-native install", didn't worked correctly here for the android-part because it is not implemented in the 3rd-party-library right now, that i've used for this example.
That's why gradle didn't take notice of the library. After setting it up correctly, the folder react-native-sqlite-storage appeared in Android Studio and i was able to pass a breakpoint and to stop the execution there.
Nevertheless, debugging this library works fine, but when i wan't to step into lower/"deeper" methods of android SDK, it still has issues to point to the correct line of code ("Sourcecode does not match the byte code")

How can I enable debugging with breakpoints in IntelliJ for gradle based Google App Engine project?

I have created a Google app engine project using gradle and am using IntelliJ for implementation.
I am able to run the application using gradle task but when I try to debug it the application doesn't stop at the break points.
The debugger always seems to be listening at a different port.
I have added the following JVM flags in gradle.build but with no luck.
jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999']
Any help is appreciated.
You can create a run/debug configuration by going to the drop-down for your run configurations in the toolbar. Use the 'Google App Engine Dev Server' configuration and you don't need to worry about setting the jvmFlags. I have written many Gradle/App Engine projects and have debugged them this way without issue.
You will need to specify your app engine application server. If you hit the ... next to the drop-down you can navigate to where you have it downloaded. I have always used the app-engine gradle task to download gradle. Then you find the latest app engine download in your .gradle directory.

How do I fix the Android Studio error: "Cannot start uploading: The tools sdk jar could not be located." in Android Studio?

Recently, I have found an interest in Android coding, so I decided to download Android Studio. I decided that before I program my first application, I would first see if I could send a blank application to my developer account in order to test if it would send.
I made the project, then added a Google Cloud Module. I set the Module type as App Engine Java Servlet Module, and the client module as app. At first, the error was:
"Error: Invalid App engine SDK Path."
I soon found, however, that the reason was because the gradle appengine-java-sdk was out of date, as it was on version 1.9.18. So, I installed the latest version, which is 1.9.24. So, I turned Synchronize with build.gradle configuration.
That fixed the error, so I went to Build>Deploy Module to App Engine. I selected my module, and set my cloud ID, then hit deploy. I then get a pop-up that states:
"Cannot start uploading: The tools sdk jar could not be located."
Make sure that your JAVA_HOME global variable is pointing to your JDK location. See this answer and this other question.

Eclipse Java Web app generating following error - "Generating the api metadata for your cloud endpoints classes"

When I try to create a new web app, eclipse automatically gives the error below:
"There was a problem generating the API metadata for your Cloud Endpoints classes: unknown protocol: c"
I searched on many places but I couldn't find an effective solution.
I changed the SDK version 3 times. I tried 1.9.17 - 1.9.15 - 1.9.13 - 1.9.3 but always results in the same error.
Solution is here
Right click on the project
Properties-->Builders
Uncheck the Google App Engine Project Validator.
Then clean the project.
Then check the Google App Engine Project Validator again.
Then left click the project,
Go to Project-->Build Project.
If it still doesn't work for you try with old versions of App Engine like 1.9.3 and older.
I had the same problem becouse It was an error in my *.gwt.xml.
There was a wrong path in
<set-configuration-property name="gin.ginjector"
value="com.gwtplatform.samples.basic.client.MyGinjector" />
My MyGinjector has another location.
When it was fixed, all was good.
Make sure that the path of the project workspace, eclipse install folder and Google App Engine folder does not contain any spaces.
I think the "c" at the end of the error refers to the Windows "C"-drive.

Android Facebook SDK no class def found com.facebook.android.Facebook

I'm using a version of the Facebook SDK, I'm not sure which version as I was given the eclipse project and told to use it but it was given to me before SDK 3.0 was released, so most likely 2.0, in an Android app. The app's project has the SDK project listed as a required project to enable us to prompt for Facebook login within the app.
I've tried telling eclipse to export the project with or without the Facebook project but it makes no difference.
I have also tried running the app both with and without the official Facebook app installed.
Every time I try to initiate the login for Facebook, I get the message:
01-24 19:05:11.863: E/AndroidRuntime(12697): Caused by: java.lang.NoClassDefFoundError: com.facebook.android.Facebook
Any help or insight is greatly appreciated.
As it turns out, one of my team-mates loaded up the project from Git, compiled it, and ran it with no changes and it works just fine. Clearly something is messed up with my setup somewhere whether it is with the Facebook SDK or Eclipse. I'm running Eclipse Juno, he is running Eclipse Indigo.
This turned out to be because I hadn't included the library project in the "Android" section of the project's properties.

Categories