I'm recreating my iOS app for android using android studio and Kotlin. I'm using Firebase Realtime Database for some functionality on my app and I was making a timestamp for some things in the layout of : "2022-01-01 23:46:37 +0000" as a string for example.
Now I can't seem to figure out of to get this kind of Timestamp format in android studio using Kotlin. what am I missing for what function should be used?
I'm using this to get the desired format and it seems to do, not in a nice way, the trick.
val timeStamp: String = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date()) + " +0000"
Related
I am working on writing a native app written in Kotlin and compiled with the GraalVM. Part of this requires me to open and manage spreadsheets (xlsx).
When I run the app in vm mode using any JVM, including Graal, everything works fine. However, when I compile the app native, I get an error when I attempt to open the same excel file as the one I open in the JVM. For the record, I am using apache POI
UnsupportedCharsetException: CP1252
Can someone explain why it works in JVM mode but not native?
a snippet of the stacktrace:
java.lang.ExceptionInInitializerError: null
at org.apache.poi.poifs.filesystem.FileMagic.<init>(FileMagic.java:133) ~[pikr:5.2.3]
at org.apache.poi.poifs.filesystem.FileMagic.<clinit>(FileMagic.java:74) ~[pikr:5.2.3]
And the code in question in POI:
FileMagic(String... magic) {
this.magic = new byte[magic.length][];
int i=0;
for (String s : magic) {
this.magic[i++] = s.getBytes(LocaleUtil.CHARSET_1252);
}
}
Try adding -H:+AddAllCharsets to your command line.
There must be some way to add a few specified charsets only, but I cannot find it in the options (native-image --expert-options-all)
I started learning Kotlin in Android studio a few days ago and I still haven't figured it all out, so having this problem is a big question mark for me, I know nothing yet about gradle. Screen of faild gradle
I just created a new empty activity and it suddenly appears out of nowhere.
this is my buildgradle file :
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false}
task clean(type: Delete) {
delete rootProject.buildDir}
I was able to fix this by disabling offline mode of gradle and syncing.
Access the below by going to View -> Tool Windows -> Gradle
If button is off, press it twice to disable offline mode
Android studio will install org.jetbrains.kotlin.android automatically. When you click "sync with Gradle Files" first time, Android studio didn`t react to it. After your second click, it did. that`s all.
I solve this problem by changing my vpn,which make Android studio can connect to google.
below for someone like me in China:
我的解决办法是,Android Studio设置里开代理(socks),这个时候你点“sync with Gradle Files”,会有弹窗,记得勾选HTTPS代理,然后就行了,等它下好就行。
(其实,不要手贱点掉HTTPS代理就不会有问题QAQ)
不勾选HTTPS代理的话,在v2rayN那里会显示rejected。
So the problem is now solved .... for some reason. I just want to add that I really don't understand why (in case someone wants to help me haha).
I tried to open another project, in another widow and I did exactly the same thing. I created a new empty activity to see if the problem was with my computer or the internet. But it wasn't. Everything worked perfectly well. No gradle problems. So I closed the second project, with the idea of really trying to find an answer for my main project, but suddenly it just... worked. I did NOTHING. I just opened a second project.
I really don't get it.
The same thing happened to me. I just created a new project and the problem is solved.
Update your plugins to
plugins {
...
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}
This problem occurs when there is and older version of the package (org.jetbrains.kotlin.android) so the error denotes for updating the package version .
add the following line to your PROJECT LEVEL GRADLE FILE INTO THE PLUGLINS
plugins {
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false }
NOTE : USE THIS VERSION "1.7.20" INSTEAD OF "1.6.21"
Try using a the latest version, the current latest version is:
plugins{
id "org.jetbrains.kotlin.kapt" version "1.7.20"
}
I want to create a simple AR project, however I get this message when I try to create a .sfb file from .fbx file. This is my first time with AR, and I am not really into Android so much, so I don't really know what to do.
Just change:
string variant.mergeAssets.doLast {
to:
variant.mergeAssetsProvider.get().doLast {
It will work.
you can move to a previous gradle version and it will get fixed.
I opened my app to start developing on it today, and when I loaded it, it wasn't able to be run because of an issue in the manifest file. Taking a look inside the manifest file, i get this:
PK A META-INF/ PK A (M��? T META-INF/MANIFEST.MF�M��LK-.�
K-*��ϳR0�3����-�I�M�+I,
�d��Z)�%��b�µ���r�r PK A org/ PK A org/gradle/ PK A org/gradle/wrapper/ PK A �zZ�� � - org/gradle/wrapper/BootstrapMainStarter.class�VYw�V�˖#DgH!��bSJiIh
� �#c5�žv���2$����ڗ����Sz���?B;W�op��s�ٿ�;#����g ^�O2Bx[�a�KX�pA� .�X�%���˒�e\�U���
����&Ẅ)�X�pCƻ�H���X�p+�����|y�/w�Pe�#+!�Ǽ�C(H�8��='���
�f� �Ni[.יuM]J�YU_U-��kD���Jb)�*$
���Ynn2+q�4�M�%U3Ҷj�̚�/ѵ�]����U��Hۖff]�f&4��:�V�<�� �./�E���QY#�˽�Z}�4l�e'u�TJ�j�1�j�N\_Iձ�r��vHz�|;$�a�� X,����py$9ؘ��M/y��f�L�q��[Y�ik�Q��Q)�K�e#��,�p�)O��ż�TG���d`���3�¢��r�,[Y��h��.�-(8�Q3 �^�:J=G�]ܓ�+(`*��
,���q_�l0zFq�jq��8~���Xl�C����`5eO�G�X#�.���]���O|�Ϩ�^��Yb�
>Ǩr-?� �����B���J�C|M�ݸ������(+��o|����z^)�Vd;�0�4�z.b�vD��`����".��g3r��JD3<rN�2h�en!2>V�+�?��~0�?{��g7�����y}�^#O4V����%\�I�Z$S$9�T�����.٬��q��f
�]�}U��A�!�
������+��
��ԏ{�e����
n]*���d��0}��N�ε�0m�J- kмYq���Z�N�ee��x4�5�y����z7n#4���b�$�w����Ѧ9���z���'e4�2l$��� �X��)��L#��jSC�Łv)�I#�EBM#��
��m���g�0}����y��[�v�v�D�c:t`�րCc�*� ���2&H�+?'9����T�O�ˈ#���+�WH?�TA���� �X���R*�;��C]$ݝ���']A�L ���&��w#,���G\�7x�ϣ;�NZ���r���?�a\�V�mˈã��FX���&1� �cqB�JC�l�"���[F$k'��UB�m��k$u����:�� �H��d�� ��V�c���O1���bᥩgs�S�x�g�L
�'x*
I assume that this is some sort of encoding file issue, I've tried reverting back to previous versions of my project from days ago when it was working and it only shows the encoded version of my manifest file. Is there any way I can turn this back into my correct manifest file?
I am using the newest version of android studio.
Any help is appreciated,
thanks
I want to scan all XML-Files that have been checked out of the Server.
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt project =
dte.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt.Project;
I tried this. But i get a NullPointerException.
I'm looking for something thats triggers an event or something. On Serverside there is the ISubscriber interface.
The dte object isnt working either cause it hast no event trigger.
----edit---
There is a "GettingEventHandler" in Tfs.client Package. I can bind things together but i need the VersionControlServer Instance running in Visual Studio 2015
As an alternative, you can also install the TFS 2015 power tools.
You can find files that under version control by status by selecting File -- Source Control -- Find -- Find by Status, then you can find all checked out files in the path you select.
I read over that all Events from TFS are crossinstance. I just started a new instance and attached my eventhandler to it. It works great.
tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serveradressename));
versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
versionControl.Getting += new GettingEventHandler(ScanAllNewDocs);