Can anyone tell me how to build my app in release mode? I'm having issues getting to the permissions screen on my android (java) application, I keep getting GoogleFit: RESULT_CANCELED error and then activity closes.
Another user suggested building in release mode, my SDK is generated for release and I have updated my gradle files but nothing is working.
I have asked for help a few times since yesterday with no luck so if anyone can help that would be appreciated!
Link to my other question with problem in detail
I'm assuming you are using Android studio. To build the app in release mode. You will need to find a window called Build Variants which should be at the lower left screen of you workspace. And you will see the modules you created for your APP. And just change Build Variants from debug to release.
Here is the official document link for your reference Build and Run your App.
If you sre using Android Studio then you can go to build > Build Signed Bundle/APK....proceed and at the end Mark "release".
For more details you can search "android studio Generation Signet APK".
But I believe your problems lie deeper than that, I dont think it has anything to do with how you build your APK.
Related
My Android studio gives me error. The build error whenever I try to run any project. Please help how to solve it
It seems Gradle is in offline mode and thus can't download required resources. This page explains how to turn on offline mode, I'm pretty sure you can figure out the inverse from there.
I should preface this by saying that I don't know much about programming or android app development at all. I am trying to get a program running to control my pool cover automatically. This program is fairly old, which I imagine is the reason for the issues. I have been following this guide to sign and bundle the APK. As soon as I clone the project from github, I am greeted with this:
ERROR: Could not determine the class-path for class com.android.tools.idea.gradle.project.sync.ng.SyncAction.
In addition to this, the "Generate Signed Bundle / APK button" is not available.
From what I can gather, this program uses Gradle 1.10.
Here is the complete output log that I got from android studio
I might have found a solution for your problem but being a project as old as this, you can have problems with library usages.
The reason you're seeing this error is, using info from this answer, because this project was written in Eclipse IDE. The answer says:
when Eclipse export a project to gradle, it use an old gradle plugin version that Android Studio doesn't support.
Following his instructions I changed my Gradle version to 2.3, but Android Studio showed some more errors asking me to upgrade my version to 3.3, as showed here in Project Structure (You can easily access this using Ctrl + Alt + Shift + S).
Notice that Android Studio also asked me to set my gradle plugin version to 2.3 on another error, that I did. You should be aware that I had to change my distributionUrl in gradle-wrapper.properties file, as you can see here
Lastly Android Studio demanded me to change buildToolsVersion because it couldn't make my app with original config. Also what gave me the most trouble was the runProgruard function that Studio said didn't exist. I found the solution in this answer. My app build.gradle ended like this.
PS: At EVERY step of changing this configurations I had to go to menu build->rebuild project and then use the gradle button "try again". Sometimes it might seems it is not working, but with patience you will get there.
I have made a simple app. It was running fine. I had never used git. So, I watched a simple tutorial on youtube and installed the git and have made an account on Github. And also have added the account on the android studio and made the initial commit. Just after that, an error is showing in (ExampleInstrumentedTest.java)... and when I try to run the app. it builds without error but fails to install in my android device.
I searched for the solution on google. And find that disabling the instant run can solve this. but in the latest version of the android studio. instant run feature is not used.here is the screenshot and here is the screenshot for dependencies
Edit: now I have found out that it is running on other android devices but not on my android device. I think this problem arose after I unrooted my android device.
Just close the project and import it same.Its work for me.
File > New > Import Project > your project
Go to Build >Clean Project followed by Rebuild Project.
If it works then ok, otherwise uncommit git changes and then rebuild Project. It will work.
It was not installing the app on my device since I had unrooted my phone. So, I rooted the phone again and now the problem is solved.
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")
I have just updated my eclipse through Android SDK Manager, my eclipse pop out and error about the Android SDK.
This Android SDK requires Android Developer Toolkit version 23.0.0 or above.
Current version is 22.6.2.v201403212031-1085508
When I pressed the button "Check for Updates", the result from eclipse is "No Updates were found."
I am sure that my Android SDK should be 23.0.0 above.
All my project listed in the left corner of above picture contains errors.
I have studied this thread and I found that the "Java build path" was "Unable to get system liberary for the project"
The project was not built since its build path is incomplete
Whenever I tried to add the JRE System Library, it failed beacause of "Could not write file: C:\Users\Admin\workspace\ICEAPP(20140819_uc).classpath."
Can anyone give me so help?
Update the ADT-Plugin in eclipse (Help > Check for updates)
You have to remove the whole installation and reinstall everything again. This update seems to fail always. But reinstall works for all of this issues. With the new version 23. It seems there is a big compatibillity problem unsolved yet.
Check for updated fails but eclipse say it need one update. Also SDK Manager seems to be up to date.
Anyway, even if you get ot working, there still are problems for example with implementation of google play service.
Had a lot of issues by myself and others to, but reinstall solved it