IDEA not updating libs at all (Flash)

So, ive been sitting here now for 4 hours and wondering why the heck my application uses wrong methods.

Finally i discovered that the ANE and SWC that are included in my app (under dependencies tab) are not re-loaded.
I mean, ive created new SWC as well new ANE, at least 50 by now, but i still get error in logcat that the method im trying to call is not there.

So as fast test, added Log.d into every method, after every line of code in Java (not a big lib so it was no pain ;)) and when rebuilding the AS3 lib
then using my ANEBuilder to compile ANE file, and finally running the application in debug.. i see no log.d's there.

This means, My application project, has cached something. big time and hard!
Now, i've also run both variants under File -> Invalidate cache, but still absolutely no progress, still stuck with a old SWC / ANE

When removing both ANE and SWC from app, intelli complains, (awesome, this must work) and when adding them back under dependencies,
ahh back to square one, same old ANE is compiled into the app.

So, how do i ALWAYS get the latest SWC and ANE into my apps ?

Eclipse and Flash Builder are good at that, just save and everything is done behind the scenes. Also the SWC is updated from eclipse / fb  when saving the .as file.
Is there something similar in Intelli ? Like Clean project in Eclipse ?

Comment actions Permalink

This really is annyoing, not to be able to find how to force intellij to reload ANE libs.

Is there absolutely nothing on this issue ? I have searched but what i've found, nothing helps. I must be missing something...

EDIT: I think i found the problem now, Ecplipse by default exports classes into $PROJ/bin/classes folder, which obviously IntelliJ IDEA does not.
Since i am using ANEBuilder to compile ANE files, i had it coded for searching inside /bin/ folder for classes folder...

So, i think the solution would be either to manually copy over the classes each time into bin/classes or to somehow make IDEA to export into that folder.

Im not so enthusiastic in changing the ANEBuilder source just for intellij output structure since most peeps use Eclipse.
Kind of dislike that each application which are supposed to to same things, use their own structures, whats worng with the eclipse structure ?

Comment actions Permalink

So if I understood you correctly you were building ANE files based on outdated classes in bin/classes folder whereas up-to-date classes were in out/production/..., right? Everything is configurable in IntelliJ IDEA, so you can change output path at Project Structure | Modules | <your java module> | Paths tab.

IntelliJ IDEA doesn't cache swc of ane files. It calls Flex compiler from the Flex SDK and Flex compiler doesn't cache whatever as well. So you need to double check your dependencies. Make sure that you don't add both swc and ane version of the same library. Only ane is needed. If you have not only individual swc/ane files cofigured as dependencies, but also folders, make sure that these folders do not contain extra SWCs that should not be imong dependencies. I suggest to always configure individual file dependencies instead of folder.

Comment actions Permalink

Thanks for your response. I discovered that the SWC didn't need to be imported, quite good actually.
Also thanks for the tip of classes export. I managed to configure desired output structure in some way and it did work quite well.

But I have another question, for java and as3 I need to hit rebuild every time I want to apply the latest changes in classes, to be able to compile one, as eclipse and flash builder do, they auto export sec for as3 lib and .class for java, is there something similar in intellij?  

Would be awesome not to have to rebuild after every small change.

Actually love intellij, tho its always hard to goto new environment after many years with one ide.

Comment actions Permalink

Why do you need to rebuild project? What's wrong with 'Make'?

IntelliJ IDEA 12 has 'Make project automatically' option at Settings | Compiler. Though it works only for Java and doesn't compile Flash. But usually you don't have to compile whatever manually because when you click Run or Debug - it compiles what is requred for this run configuration.

Comment actions Permalink

Uhm not quite sure, IDEA has new terms that im not yet familiar with :p

What im looking for is:
I got 3 projects open,
2 AS3 library
3 Application project

The 1 and 2 are for ANE, and im compiling those  into ane with ANEBuilder which basically only needs .class files from JAVA and a SWC for as3 library.

After the ane is compiled, only then i can run the point 3, application.

In eclipse the workflow is easy (probably cause im used to it), save both JAVA and AS3 Lib and i only need to run the compiler. I never need to compile or "make" anything for to be able to run ANEBuilder.

I hope im clear with what im looking for.

Comment actions Permalink

First, some terms.
IntelliJ IDEA project is an analog of Eclipse workspace,
IntelliJ IDEA module is an analog of Eclipse project.

So usually you don't need to have more than one IntelliJ IDEA project open. Project can contain different modules: Java, Flash, and whatever. Java modules can depend on each other. In case of Flash modules there are no module-on-module dependencies, because Flash module can contain more than one Flash build configuration (BC), so there are BC-on-BC dependencies.

In your case I think you can have either 2 separate projects (one with Java and SWC and the second one with the main app) or 1 project with all 3 modules. If you prefer the latter - make sure that you do not have dependency of the main app BC on library BC. Configure main app BC on ane file dependency. Note that if you were not developing ane but were using own SWC as an ordinary library you'd have to configure BC-on-BC dependency (i.e. not BC-on-SWC file).

After making some changes [1] press Make (Ctrl+F9 on Windows), then [2] run ANEBuilder, then [3] press Make again (or launch Flash run configuration for the main app).
[1] Yes, probably main app will be compiled against previous version of the ane file, though you don't need app to be compiled at this step at all. You can avoid app compilation if you right click Java and SWC module in Project View and select Make Module. With 'Make project automatically' option checked you'll need to right click only SWC module that is not covered by automatic compilation.
[3] IntelliJ IDEA will notice that ane file was updated and will compile only app, but won't compile other modules which are already up-to-date. Make sure that 'Use external build' is enabled at Settings | Compiler, because otherwize ane file change may be missed and app won't be compiled.

May be IntelliJ way is 2 clicks longer than Eclipse one, sorry, we haven't optimized IntelliJ workflow for ANE development yet.

Comment actions Permalink

Thank you for a good description, i think to fully understand what you explained, i need to test it myself.
I'll return if im encountering any problems.

Comment actions Permalink

Tried to search for possible solution but dont really know what
to search to get the most relevant answer.

I have extracted a JAR file, so theres lots of .class files, when making the project, i would need
thos .class files to be in my bin/classes/ folder together with my project classes (yeah, am using custom output path)

Ive tried to add in dependencies and in library but when hittin "make" i only get my classes from src/ in bin/

Is there any way to always get the extracted class files in output folder, without using macros or anything like that ?

Comment actions Permalink

During compilation IntelliJ IDEA copies resource files from source folders to output folder (preserving relative paths). Resource patterns are configured at Settings | Compiler page, so you can add ?*.class pattern there. Press Help button on this page for more info.

Above is true for Java modules. For Flash modules resource copying rules are set at Compiler Options tab of the corresponding Flash build configuration (Project Structure dialog).

Comment actions Permalink


that pattern was already present. Altho which folder or where exactly do i need to add the folders containing classes ?
Is there anything in project structure i need to add ?

At the moment i have the extracted library folders in libs/ folder, but it seems compiler is not snapping them up from that folder.

Comment actions Permalink

IntelliJ IDEA copies resource files from source folders to output folder. Source folders are configured at Project Structure | Modules | <your module> page, Sources tab (I assume the question is about Java module, not Flash).

Comment actions Permalink

My bad, you're absolutely right, this is Java module :)
Ill check your suggestion out...

Comment actions Permalink

My answer assumes that you do not use these classes in your code, so you don't need to setup whatever at Dependencies tab of the Java module.
By the way, what is your use case? Why do you need to have *.class files copied to output folder?

Comment actions Permalink

I added libs/ as sources (so libs/ is blue) but it doesnt seem to copy the contents from libs to outputfolder..

Comment actions Permalink

Im working on a special case here.

Am trying to create a Android extension fom Adobe AIR and that extension requires 3:rd party lib.
Now the problem is that AIR native extensions do not compile .jar files, it must be extracted and
its contents needs to be used as "part of extension".

I've tested, if coping com.3rdparty  folder structure into bin/classes, and compiling and running
adobe air application using this way of appreoach, it works as expected.

Only problem is that i need to make sure that the 3rd party classes files are always present with my own classes files.

(I could of course copy 3rd party classes into bin/ folder, that works quite nice too, but for future projects, i need to know
how i could to just to minimize nessesary steps and let IDEA to handle it for me. I like when IDE is handling actions for me not the otherway around hehe)

Comment actions Permalink

I have a better solution for you. First, revert previous attempts:
- you do not need to keep extracted jar anywhere. Keep single jar file in libs folder if you find it convenient
- do not mark lib folder as a source root
- remove *.class from Resource patterns
- if you reference classes from this jar in your code - no problem, configure it at Dependencies tab

More convenient solution is based on IntelliJ IDEA Artifacts concept:
- Open Project Structure | Artifacts
- Create new Artivact ([+] button) of type 'Other'
- Give it some name, configure its output directory
- At Output Layout tab press [+], select Extracted Directory and select path to your jar
- Mark 'Build on make'

Now jar will be extracted to the correct folder automatically (and incrementally, i.e. only if changed) when you compile your project.

Comment actions Permalink

This is just getting better and better.

Very cool feature and working sweet now :D

TY so much!

Edit: Never mind, seems after 1 minute everything got back to as it was. It probably needed to re-scan the project or something, since i did nothing and the problem was gone by itself after a while.

Tho i got one more question while we are at it, from time to time, IDEA tells me "Cannot find symbol". Like right now,
after applying the changes you directed me, i now get this error.

Just before i added artifacts, there were no problems. Also when typing in editor new Par.. I get no code hinting as IDEA
seems not to be able to find the Class. (Note the class is in same package and i also tried to add import but no help )

I had same problem earlier but managed to solve it by deleteing that symbol/class file and re-created it from beginning, tho i believe there is simpler ways to correct the error

Comment actions Permalink

Please check source roots configuration once again. Looks like the file you are editing is not within source folders. Make sure that no folders or files are configured both as module sources and any library root.
Also general suggestion is File | Invalidate caches and IntelliJ IDEA restart.

Comment actions Permalink

All files that i edit are present in source folder. But i think the cache invalidation (had forgotten i ran it) seemed to fix the error :)

Thank you so much Alexander!
This is probably the best (dedicated) support i've ever gotten!
Greatly appreciated!


Comment actions Permalink

You are welcome! B-)


Please sign in to leave a comment.