CI/CD BitRise React Native Android Build Failing - android

Facing issue while build on BitRise.io
I have a React Native Project which builds successfully on local.
Using BitRise.io for CI CD.
Added App and provided all the essential information and keystore file as well.
Followed their getting started guide and everything they'll need is in place.
Tried to build multiple times but getting this error :
Failed to open project, error: no build.gradle or build.gradle.kts file found in (/Users/vagrant/git)
| x | android-build#0 (exit code: 1)
Not sure why they are not able to find build.gradle.

There was an issue with BitRise App Setup & Configuration while adding React Native App.
Although I provided Android Project Path, Module & Variant, It only added in their variables and did not add it to inputs of Build Step, I had to manually add this inside BitRise.Yml to make it work.
- android-build#0.10.0:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: "$MODULE"
- variant: "$VARIANT"

Related

Using flutter module in kotlin multiplatform app

I created an application with kotlin multiplatform and I want now to use flutter to develop the UI once. I followed the tutorial to integrate flutter in an already existing Android app and I choose option B to compile everything in one step.
The first trouble is including the Flutter module as a subproject in the host app: in the kotlin multiplatform project, I have to rename the settings.gradle.kts to settings.gradle. Then I have another error I can't get rid of: Caused by: java.lang.AssertionError: Project :app doesn't exist. To custom the host app project name, set 'org.gradle.project.flutter.hostAppProjectName=<project-name>' in gradle.properties.. Expression: (appProject != null). Values: appProject = null
I understand what the error means: with kotlin multiplatform, the project is not called app but the name of the app, in my case MusicTraining. So as mentioned in the kotlin documentation:
Tip: By default, the host app provides the: app Gradle project. To change the name of this project, set flutter.hostAppProjectName in the Flutter module’s gradle.properties file. Finally, include this project in the host app’s settings.gradle file mentioned below.
So, in the flutter module's gradle.properties file I tried to add the lines:
flutter.hostAppProjectName="MusicTraining"
flutter.hostAppProjectName=":MusicTraining"
I still have the same error.
I tried with vscode to change all instances of :app to :MusicTraining but nothing works. I still have the same error.
As the error mention, I tried to add the line
org.gradle.project.flutter.hostAppProjectName="MusicTraining"
org.gradle.project.flutter.hostAppProjectName=":MusicTraining"
in the flutter module's gradle.properties file, but still the same error.
How can I integrate a flutter module in a kotlin multiplatform app?
Try to add flutter.hostAppProjectName=MusicTraining into gradle.properties file with both Flutter module and you root project.
Notice: run you native application, If you run main.dart, you still get this error
I face the same problem, this works for me.
If you already have a Kotlin multiplatform project, I'd use Jetbrains Compose multiplatform instead of Flutter. Compose is very similar to Flutter and you would avoid the technology split.
https://www.jetbrains.com/de-de/lp/compose-mpp/

React Native: Generate Signed APK: Errors while building APK

I have just completed my 1st react native project and now I am trying to generate its APK file by generating a signed APK using Android Studio but I am getting an error and I don't know why I am getting this.
The Gradle build starts running and after that in event log I get an error:
Generate Signed APK: Errors while building APK. You can find the errors in the 'Messages' view.
In the message view the error that I get is:
Type io.invertase.firebase.BuildConfig is defined multiple times: F:\Salvador\node_modules#react-native-firebase\app\android\build.transforms\201acb16e5bf3be0b3bc4a9933889ad1\classes\classes.dex, F:\Salvador\node_modules\react-native-firebase\android\build.transforms\9affd011dae86c883f20504c5a21ffef\classes\classes.dex
This is a problem I have been solving in my projects last days. And I think I have some good (not perfect) solution so far.
Implementation in android/app/build.gradle
def enableSeparateBuildPerCPUArchitecture = false

React Native App - The development server returned response error code: 500

I'm asking again because my case wasn't solved on previous answers.
I created a React Native App that works perfectly on Snack, but then I wanted to try it on Expo(I want to add some modules that Snack can't load).
So, I used create-react-native-app to make my project.
Then, after editing the code, I tried to launch it using the Genymotion emulator, but everytime I do it, the below error occurs :
I can't understand what's wrong with it?
I already tried removing node_modules folder, changing React Native and Babel version and reinstalling the project with npm install.
Also, in console, it shows me this error:
22:33:56: Unable to resolve ./components/AssetExample" from "./C:\\Users\\danie\\HC\\App.js`: The module `./components/AssetExample` could not be found"
22:33:56: Failed building JavaScript bundle
but I don't know where should this module be imported? package.json or package-lock.json?
I launch it in Genymotion using the following:
cd HC
npm start android
What can I do? Please help me.
React Native version: 0.55.2
Babel(preset React Native) version: ^4.0.0
Edit: Project Structure & code as requested, I created the repository on GitHub: https://github.com/DanielVip3/HC
^ I didn't push the node_modules folder because it was too large, but I think you already know: it contains all the modules that React Native uses.
The application is looking for ./components/AssetExample in your own application folder.
Please give us your project structure and the code in App.js file (also make sure you export AssetExample class in AssetExample.js file.
What i understand you are trying to do is (probably) that in App.js you import AssetExample from "./components/AssetExample", so possible errors are:
1) path is wrong
2) you don't export default AssetExample in AssetExample.js

Run Robolectric tests from IDEA

I'm trying to run
RobolectricSample
RobolectricDemoProject
project with IDEA and i got error
Class not found: "de.peterfriese.robolectricdemo.MainActivityTest"
Process finished with exit code 1
but when i use gradle test command all is ok.
this is my Junit config
now, in IDEA you have using non gradle project. That mean you can look on project structure (Ctrl+Shift+Alt+S) and look on Library visibility. (Runtime, Provided,etc) also export property are exist. When library are provided or no exported, it will be absent in target apk.
Also you can build project as gradle test project. so IDEA will use your gradle test target. Build will take litle more time.

How to solve the Dalvik error in adding libs to another project to make a Lite version of my Android app?

In my app, I have to have two version: Full and Lite.
I am following these tutorials:
http://bitowl.wordpress.com/2011/07/06/tutorial-how-to-make-full-and-lite-versions/
http://blog.donnfelker.com/2010/08/05/howto-android-full-and-lite-versions/
So, I build my full version, and make it a library. This full version uses some other libs, needed to some components.
Then, I create a new project and added the lib created. The problem is when I try to run my lite version, eclipse gives this error:
[2012-12-13 13:58:13 - <app> Lite] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lnet/simonvt/timepicker/R$attr;
Conversion to Dalvik format failed with error 1
The simonvt/timepicker is one of the libs that I use in my full version.
How can I fix this?
Thank you!
Do the following:
Right-click on your project and choose Build Path -> Configure Build Path,
then go to order and export section
If simonvt/timepicker has a checkmark against it, then deselect it.
I believe that the problem is that the library project is already added and you might be trying to add it again.

Categories

Resources