[Interest] ANDROID_PACKAGE_SOURCE_DIR IS EVIL [was: How to create a library with Android java source]

Gianluca gmaxera at gmail.com
Sat Oct 24 16:56:08 CEST 2015


Hello Ben,
thank you very much for your support.

I found the problem. The evil parameter is ANDROID_PACKAGE_SOURCE_DIR that in some way block any include .pri to install stuff into android-build … but does not block any install command at the same “level” of where ANDROID_PACKAGE_SOURCE_DIR is defined.
That’s a very weird behavior I cannot understand who cause it.

ANDROID_PACKAGE_SOURCE_DIR can be easily replaced by an INSTALL command like that:

	ANDROID_SOURCES.path = /
	ANDROID_SOURCES.files = $$files($$PWD/BundleData/Android/*)

INSTALLS += ANDROID_SOURCES

And the behavior is more consistent and does not conflicts with INSTALLS defined into included .pri

I proposed to remove ANDROID_PACKAGE_SOURCE_DIR in future qmake release if it’s really redundant and may cause problem.

Thanks,
Gianluca.



Il giorno 24/ott/2015, alle ore 15:21, Gianluca <gmaxera at gmail.com> ha scritto:

> Hello Ben,
> I tried your example … and does not work for me. The Java sources from quickandroid.pri are not copied into android-build :-(
> 
> Ciao,
> Gianluca.
> 
> 
> Il giorno 24/ott/2015, alle ore 10:29, Ben Lau <xbenlau at gmail.com> ha scritto:
> 
>> 
>> I am using Qt 5.5.0 on Mac and it is fine. May test Qt 5.5.1 later. By the way, could try this example project and see could it install those Java files?
>> 
>> quickandroid/examples/quickandroidexample at master · benlau/quickandroid
>> 
>> On 24 October 2015 at 17:12, Gianluca <gmaxera at gmail.com> wrote:
>> The latest version. Qt 5.5.1 and 3.5.1
>> But doesn’t work also on my PC at work that has Qt 5.5.0 and an older Qt Creator.
>> I’m working on Mac.
>> 
>> Ciao,
>> Gianluca.
>> 
>> 
>> Il giorno 24/ott/2015, alle ore 10:10, Ben Lau <xbenlau at gmail.com> ha scritto:
>> 
>>> What is your Qt and Qt Creator version?
>>> 
>>> On 24 October 2015 at 17:04, Gianluca <gmaxera at gmail.com> wrote:
>>> Hello Ben,
>>> I’ve no problem on running the app on Android. My app as a custom Activity and java LiveWallpapers, no problem at all on compiling these java files.
>>> The android-build directory is there and contains all files I specified into my .pro with ANDROID_PACKAGE_SOURCE_DIR.
>>> Then, I have a QFacebookBinding.java that I want to move outside the .pro and make as its own library.
>>> So, I created a qtfacebook.pri, I added the code as you suggested and I included .pri into my .pro.
>>> The only missing JAVA files are the ones listed into QA_JAVASRC … and I don’t know why they are missing.
>>> 
>>> If I open the Terminal and I manually run “make install” … it successfully copy also the QA_JAVASRC files. But If I run the build from Qt Creator, those files are not copied :-(
>>> 
>>> Ciao,
>>> Gianluca.
>>> 
>>> 
>>> Il giorno 24/ott/2015, alle ore 02:50, Ben Lau <xbenlau at gmail.com> ha scritto:
>>> 
>>>> 
>>>> Those line will copy Java source files to android build directory before making apk file. In Qt Creator,  selected Android target , then build. Check your build folder. Did it contains following files?
>>>> 
>>>> android-build/src/org/qtproject/qt5/android/bindings/QtActivity.java
>>>> android-build/src/org/qtproject/qt5/android/bindings/QtApplication.java
>>>> android-build/src/org/qmaxera/qtfacebook/QFacebookBinding.java
>>>> 
>>>> p.s If QtActivity / QtApplicaiton.java is not present, it won't able to run on Android.
>>>> 
>>>> If not, could you post the file list within the build folder? (Run by `find` command if you are running Mac/Linux) And what is your Qt and Qt Creator version?
>>>> 
>>>> 
>>>> 
>>>> On 24 October 2015 at 04:39, Gianluca <gmaxera at gmail.com> wrote:
>>>> Hello Ben,
>>>> I replicate exactly what you did in your .pri … but does not work for me.
>>>> It’s almost 4 hours that I’m trying to understand why … but I have no clue :-(
>>>> 
>>>> This is my code into .pri
>>>> 
>>>> 	QA_JAVASRC.path = /src/org/gmaxera/qtfacebook/
>>>> 	QA_JAVASRC.files += $$PWD/Android/src/org/gmaxera/qtfacebook/QFacebookBinding.java
>>>> 	INSTALLS += QA_JAVASRC
>>>> 
>>>> Why does not work for me ?
>>>> 
>>>> Thanks,
>>>> Gianluca.
>>>> 
>>>> 
>>>> Il giorno 22/ott/2015, alle ore 11:32, Ben Lau <xbenlau at gmail.com> ha scritto:
>>>> 
>>>>> Hi Gian,
>>>>> 
>>>>> You may check my project on github. It is a Qt library for Android with Java source code. In the DEV branch, it has a native image picker written with Java. You could find out how to include Java source file as a library from the example code.
>>>>> 
>>>>> https://github.com/benlau/quickandroid
>>>>> 
>>>>> 
>>>>> On 21 October 2015 at 22:43, Gian Maxera <gmaxera at gmail.com> wrote:
>>>>> Hello,
>>>>> I’m moving all my common source files into a library and share the code between my Qt projects.
>>>>> The qmake .pri file works fine … but I have problem on how to include also Java source files when the target is Android.
>>>>> 
>>>>> I found this blog:
>>>>> http://imaginativethinking.ca/what-the-heck-how-do-i-share-java-code-between-qt-android-projects/
>>>>> 
>>>>> Is there no other alternative ??
>>>>> 
>>>>> To qmake developers: can we make this process easier ?
>>>>> 
>>>>> Thanks,
>>>>> Gianluca.
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Interest mailing list
>>>>> Interest at qt-project.org
>>>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151024/71cb63a4/attachment.html>


More information about the Interest mailing list