¿Cuál es esta característica de IntelliJ IDEA (establecer el objetivo de compilación en las propiedades del proyecto)?

If you go to "Project Structure -> SDKs" and click on some Android SDK, you will see the screen below.

When I add some Android version for the first time, the build target is set to 1.5. It seems that IDE's intellisense is relying on this selection, because in the initial use (e.g. when the target is set to 1.5) I cannot use features like android:installLocation or android:targetSdkVersion. They're just not showing up in the intellisense. When I change the build target to, let's say, Android 2.2 and reopen the same project, these attributes appear in intellisense.

Could anyone explain what is the purpose of this and why does it set to Android 1.5 by default? It just makes no sense to me. I also haven't noticed this option in Eclipse.

preguntado el 30 de enero de 12 a las 19:01

1 Respuestas

Build target defines the platform that is used. So you normally don't need to change it. And it doesn't default to 1.5, it defaults to the platform version that you've chosen when adding the new SDK platform. So, if you add Android 3.2 Platform, build target will default to Android 3.2. I've verified it with IDEA 11.0.1.

If you change it to something else, it's the same as changing your project/module dependencies to use another Android platform, however the old SDK name remains that can make it really confusing. We are considering to make the build target and SDK home path settings read-only to avoid confusion.

Respondido el 31 de enero de 12 a las 17:01

Hm, all build targets in my IDEA has been downgraded to 1.5 and I am sure I did not do that. I will change all target to its corresponding levels manually. And instead of making this read-only, you could make a warning if the build target gets changed to something unordinary. I'm against read-only because how can a user revert build target to the right level if it somehow drops to 1.5, like in my case. Am I right?! - sandalias

It should not revert, it's most likely a bug that needs to be fixed. If you'll find what triggers it, please submit and issue at youtrack.jetbrains.net/issues/IDEA. - CrazyCoder

Unfortunately, I do not know. I can guess that it's not a new thing as I previously had problems with using some SDK-specific attributes, but I did not know how to solve it. I think that it started in the late summer with the first update after IDEA 10.0.3. I'm sorry I cannot help more - sandalias

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.