Closed Vanethos closed 4 years ago
PR #76 attempts to fix this
Added fix for this on android only and tested on device farm. Will add iOS support later. Please try testing with your app or with:
git clone https://github.com/mmcc007/sylph.git
cd sylph
git checkout #75_flavors
pub global activate --path source .
cd example/flavors
sylph
Didn't run into the problem with 'app id/package name' using the example/flavors app. So let me know if you do with your app.
Feel free to merge with your PR.
Hi @mmcc007
Yes, I do have the problem of the app Id being different than the package name
I'm sorry to ask this, but is there a problem with the code in the PR? I spent some days trying to understand the code and finding a good way to be as concise and as clean as possible, so if there is something wrong with it, I would be very grateful since it is also a learning opportunity for me. Else it feels like I wasted all those hours for nothing
As for the app id vs package name
You have the same package name: com/example/example/
as the app id: applicationId "com.example.example"
If for example you had applicationId "com.sylph.test"
So, when calling sylph, this line of code:
adb shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true --ez start-paused true "$app_id/$app_id.MainActivity"
Would try to call
com.sylph.test/com.sylph.test.MainActivity
which would incurr an error
My PR lets you specify a package name, com.example.ecample
, so that the same code can call
com.sylph.test/com.example.example.MainActivity
.
Also, since you specify the app id, you don't have to search for all the possible app suffixes or prefixes in gradle, since you can have a different application id for each flavor (I have worked in some projects like this), which is why it is vital to specify it in the sylph.yaml
file
Sorry for the separate branch. It was a convenient way to try to reproduce the problem and add some code. I will merge to your PR as appropriate (now that I know how to merge to PRs 😆). Thanks for your contribution.
Not super familiar with flavors. Seems like there is more than one way to config flavors (for android and ios). Is it possible to add an example to the example directory that shows how you are configuring for flavors? That way, I can get up to speed with what you are running into.
No, no problem!
It's just that I assumed that there is something wrong with my code, and to be honest I would love to learn what it is, since well... I learned bash to help out with this PR ahaha
As for the flavors, this weekend I'll see if I have time to add a "flavored" example, but basically it consists of:
As for iOS, I went through the bash scripts and the ruby scripts and I think that it's all okay.
Tested it with Android on AWS and the tests were successful
Great!
Added a flavor example to your PR I found in https://github.com/flutter/flutter/tree/master/dev/integration_tests/flavors that works on #75_flavors branch for android (and almost for iOS). Will test if it works on your PR (prob tomorrow).
BTW: I can run example/flavors locally using test_android.sh. So looks good that it will run on AWS.
@mmcc007 I think I went through the iOS files stuff and I think that there should no problem with the flavors in iOS:
Not sure if I understand correctly (not an expert on android intents). Does this mean your current handling of the call to the android intent may change?
Regarding iOS, based on testing on #75_flavors yesterday on example/flavors, it's getting as far as starting the test and running into a build issue related to building the wrong flavor (which should be fixable). So remains to be seen if any additional handling is required to run a flavor test on iOS. Will run same iOS test on your PR and see what happens.
I ran test on example/flavors for android on AWS and it succeeded. So that's a good thing.
Might do some experimentation of handling of intent (locally) to learn more about how intents behave.
I get the error below whether I run using
git clone https://github.com/mmcc007/sylph.git cd sylph git checkout #75_flavors pub global activate --path source . cd example/flavors sylph
or if I am in master.
@MarcoAltranDC I was able to reproduce this problem on android. I will look into it.
I confirmed it continues to work on iOS. So for the meantime, if on a mac, run on an iOS pool only.
@mmcc007 any timeline when this will be fixed? I am unable to test my app due to this. Thanks.
@mmcc007 , just wanted to know if we can get the Android fix, anytime soon... ?
Updated the reference flavor app (for androidx and latest XCode) and ran a test concurrently for android and ios (see https://travis-ci.com/mmcc007/sylph/jobs/292532712).
The reference flavor app is the currently supported and recommended way to implement flavors (taken from Flutter). There are other ways to implement flavors which may work in an CI/CD environment, but are not currently supported (in interests of simplicity).
Resources available to support other flavors implementations are limited. If alternate flavors implementations don't run on sylph, please open another issue and ideally provide a link to source code to reproduce problem.
If sylph is run in an app with falvors, the following occurs:
As you can see from the multiple lines it went to fetch not only
applicationId
but alsoapplicationIdSuffix
Additionally, the project assumes in
adb shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true --ez start-paused true "$app_id/$app_id.MainActivity"
That all applicatuons will:
This will throw an error since
adb
will not be able to find that activity