Open bbernhard opened 8 years ago
It seems to me that the method
QFacebookBinding.onCreate(this, bundle);
has not been called during the creation of the app.
Did you created a custom Android Activity as described into the readme ? And are you sure that the app has been created using your custom Android Activity ?
Could you post me the Android Activity source code and the AndroidManifest.xml are you using ?
Hi,
thanks for the quick reply! I did create the custom activitiy and also added the activity to the AndroidManifest.xml file, as described in the readme file. However, I am relatively new to the android stuff, so maybe I misunderstood something.
The AndroidManifest.xml and my custom activity are attached. I renamed both files to .txt, as github doesn't support those filetypes (I also added a .zip file with the files and their original file ending, in case renaming the files to *.txt messes up the formatting). MyCustomAppActivity.txt AndroidManifest.txt
Thanks again for helping me with this!
Kind Regards Bernhard
The android manifest is wrong. I'll post the correct one asap.
Here the changes that you have to apply in order to make it working:
package com.mycompany.myapp;
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="com.mycompany.myapp.MyCustomAppActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop">
It's the 4th line of your AndroidManifest.xml that has been changed. Look at the attribute 'android:name' changed from the default QtActivity to MyCustomAppActivity.
Thanks for the detailed description. I checked my sourcecode again step by step and changed it accordingly. However, now I am getting a few error messages during compilation:
MyCustomAppActivity.java:4: error: package org.gmaxera.qtfacebook does not exist
import org.gmaxera.qtfacebook.QFacebookBinding;
^
C:\build-qtfacebook_test-Android\android-build\src\org\qtproject\example\MyCustomAppActivity.java:12: error: cannot find symbol
QFacebookBinding.onCreate(this, bundle);
^
symbol: variable QFacebookBinding
location: class MyCustomAppActivity
C:\build-qtfacebook_test-Android\android-build\src\org\qtproject\example\MyCustomAppActivity.java:13: error: cannot find symbol
QFacebookBinding.setApplicationName(getString(R.string.app_name));
^
symbol: variable QFacebookBinding
location: class MyCustomAppActivity
C:\build-qtfacebook_test-Android\android-build\src\org\qtproject\example\MyCustomAppActivity.java:18: error: cannot find symbol
QFacebookBinding.onResume();
^
symbol: variable QFacebookBinding
location: class MyCustomAppActivity
C:\build-qtfacebook_test-Android\android-build\src\org\qtproject\example\MyCustomAppActivity.java:23: error: cannot find symbol
QFacebookBinding.onSaveInstanceState(outState);
^
symbol: variable QFacebookBinding
location: class MyCustomAppActivity
C:\build-qtfacebook_test-Android\android-build\src\org\qtproject\example\MyCustomAppActivity.java:28: error: cannot find symbol
QFacebookBinding.onPause();
^
symbol: variable QFacebookBinding
location: class MyCustomAppActivity
C:\build-qtfacebook_test-Android\android-build\src\org\qtproject\example\MyCustomAppActivity.java:32: error: cannot find symbol
QFacebookBinding.onDestroy();
^
symbol: variable QFacebookBinding
location: class MyCustomAppActivity
C:\build-qtfacebook_test-Android\android-build\src\org\qtproject\example\MyCustomAppActivity.java:38: error: cannot find symbol
QFacebookBinding.onActivityResult(requestCode, resultCode, data);
^
symbol: variable QFacebookBinding
location: class MyCustomAppActivity
I am pretty sure, that I am just making a stupid little mistake, but I can't find it. I'll definitely take a look at it again tommorrow, maybe I just can't see it right now.
If you want to take a look, I attached my project. (only replaced the app_name and app_id in strings.xml with some dummy values). I would really appreciate it.
Kind Regards Bernhard qtfacebook_test.zip
Here it is :-)
Sorry, the error was coming from something I didn't documented. The standard approach of adding Android java sources in Qt projects doesn't work very well when there are java sources coming from different repository like when you need to use my library.
So, I moved the java source file (MyCustomAppActivity) away the android directory and placed into a directory called java. Then I added an explicit Install rule for copy the java source in the proper location during the build.
Hi,
it's working! I can't tell you how happy I am right now ;-)
Now it's time to play a little bit with your library. Hopefully I understand anything and maybe even can contribute something to QtFacebook in the future as well.
Many thanks for your help and patience!
Just an idea, but would it make sense to add your fixed example as an Android sample project?
Thanks and have a nice day
Kind Regards Bernhard
Yes, it's a good idea to add an Android sample project. Can you do and pull a request ?
I just decided to extend the sample project a little bit and add other stuff (at least the possibility to logout) too. It will probably take a little while, but I will create a pull request once I'm done.
Kind Regards Bernhard
Hi,
first of all, thanks for the great project! I am really looking forward to integrating QtFacebook into my application. I just tried to add QtFacebook to my Qt 5.6 (Android) application, but unfortunately when I run the following small sample program...
...I get the following NullPointerException:
Do you have an idea what could be the reason for the NullPointerException? I tried to do all the things you described in the Readme file.
Thanks for your time!
Kind Regards Bernhard