-
Hi, I read the documentation regarding previews in Xcode and here is what I got:
But I am still having trouble with running the previews. I made a full build as the documentation says, but the preview will never load and the android app will keep reloading. |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 6 replies
-
Yes, I'm seeing similar Canvas/Preview makes the Android device reload the App. I don't understand the tie in ... I know Xcode does a build for the preview and the simulator device when one opens the Canvas. Don't know why the Gradle/Android build would get involved. |
Beta Was this translation helpful? Give feedback.
-
What version of Xcode are you running? |
Beta Was this translation helpful? Give feedback.
-
Xcode Version 16.0 (16A242d) |
Beta Was this translation helpful? Give feedback.
-
Xcode 16 as well. David Koontz Email: ***@***.*** (360) 259-8380 http://about.me/davidakoontzOn Oct 17, 2024, at 9:13 AM, marcprux ***@***.***> wrote:
What version of Xcode are you running?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Didn't want to do this, but I just cleaned everything by deleting the project and recloning my GitHub repo. @davidakoontz might be of help. |
Beta Was this translation helpful? Give feedback.
-
Marc - here’s my Build Phase code:

First part looks similar/same - but (above) also…

… On Oct 17, 2024, at 10:47 AM, marcprux ***@***.***> wrote:
Can you take a look at your app's target's "Build Phases" tab and examine the "Run skip gradle" phase to ensure that it looks like this:
Screenshot.2024-10-17.at.12.41.59.png (view on web) <https://github.com/user-attachments/assets/9478fef1-d7c9-4181-bf79-5aa6166bdfc3>
This is something that is created when the app is first initialized, and so if you created it a while ago (before this check was added), then it might not have been added.
FTR, the complete "Run skip gradle" script should look like:
if [ "${SKIP_ZERO}" != "" ]; then
echo "note: skipping skip due to SKIP_ZERO"
exit 0
elif [ "${ENABLE_PREVIEWS}" == "YES" ]; then
echo "note: skipping skip due to ENABLE_PREVIEWS"
exit 0
elif [ "${ACTION}" == "install" ]; then
echo "note: skipping skip due to archive install"
exit 0
else
SKIP_ACTION="${SKIP_ACTION:-launch}"
fi
PATH=${BUILD_ROOT}/Debug:${BUILD_ROOT}/../../SourcePackages/artifacts/skip/skip/skip.artifactbundle/macos:${PATH}:${HOMEBREW_PREFIX:-/opt/homebrew}/bin
echo "note: running gradle build with: $(which skip) gradle -p ${PWD}/../Android ${SKIP_ACTION:-launch}${CONFIGURATION:-Debug}"
skip gradle -p ../Android ${SKIP_ACTION:-launch}${CONFIGURATION:-Debug}
FWIW, previews work for me in Xcode 16 with the default "Hello Skip" app (created with skip init --open-xcode --appid=com.xyz.HelloSkip hello-skip HelloSkip and then adding the #Preview block).
Screenshot.2024-10-17.at.12.41.03.png (view on web) <https://github.com/user-attachments/assets/d360796d-0b33-42b4-acf1-2c6972b84b92>
—
Reply to this email directly, view it on GitHub <#263 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AA3SNU4XCQBVWIKR5JSHYS3Z37S3DAVCNFSM6AAAAABQBJ355WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOJXGQYTKNA>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
-
weird the images didn't transmit... it's going to be one of THOSE days... Trying again... WITH FEELING... |
Beta Was this translation helpful? Give feedback.
-
Yeah I’ve got a REPO - my count is up to 15 times I’ve started fresh… it’s an estimate.
I’d like to solve the actual issue - given that it has happened TWICE.
I make lots of stupid mistakes… but this one has proven to exist outside of my influence!
… On Oct 17, 2024, at 1:11 PM, arshmeet-s ***@***.***> wrote:
The suggestion was to check the build code as you've done. Have you tried my solution of cleaning everything and pulling your github repo? First make sure that you have a github repo btw.
—
Reply to this email directly, view it on GitHub <#263 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AA3SNU2ZEKXYNNK3FFQSRMTZ4ADWFAVCNFSM6AAAAABQBJ355WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOJXGU2DKNY>.
You are receiving this because you were mentioned.
|
Beta Was this translation helpful? Give feedback.
-
The problem is discussed at https://developer.apple.com/forums/thread/761439: Xcode no longer sets the The other solution, of course, is to just comment-out the "skip gradle" command in the "Run skip gradle" build script when you are developing with SwiftUI previews, and then just remember to re-enable it the next time you need to launch on Android. We encourage anyone encountering this issue to chime in on the thread mentioned above to try to elicit a less unsatisfactory long-term solution. |
Beta Was this translation helpful? Give feedback.
The problem is discussed at https://developer.apple.com/forums/thread/761439: Xcode no longer sets the
ENABLE_PREVIEWS
environment variable for SwiftUI previews, which is the only way we have to prevent running the skip gradle command that handles the compile/launch on Android. Toggling the "Editor > Canvas > Use Legacy Previews Execution" menu item should work around the issue for now, but note that that setting will be reset every time Xcode upgrades, so you will need to re-enable it every time there is an update.The other solution, of course, is to just comment-out the "skip gradle" command in the "Run skip gradle" build script when you are developing with SwiftUI previews, and then j…