Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Unexpected
Jan 5, 2010

You're gonna need
a bigger boat.
Thank you all.

Adbot
ADBOT LOVES YOU

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
I finished migrating my project to Gradle, but I compiled a release APK just now and noticed a couple of problems. The APK is 300% larger than when I was compiling it with ANT, and the Play Store now reports that this new APK includes localizations for every language, not just the two I actually have localizations for.

What did I do wrong?

Doctor w-rw-rw-
Jun 24, 2008

Karthe posted:

I finished migrating my project to Gradle, but I compiled a release APK just now and noticed a couple of problems. The APK is 300% larger than when I was compiling it with ANT, and the Play Store now reports that this new APK includes localizations for every language, not just the two I actually have localizations for.

What did I do wrong?

Try unzipping the APK and running du -h on the directory to compare file sizes for a better idea of the difference.

netcat
Apr 29, 2008
I'm slowly trying to get into Android development so I'm doing a small game. I'm trying to draw tiles using one large tileset and then drawing each tile as a subrectangle. The problem I'm having is that only the first tile is actually drawn.

I'm doing something like this:

Java code:
for (...)
{
  int tileX = ...
  int tileY = ...

  Rect srcRect = new Rect(tileX, tileY, tileX + tileW, tileY + tileH);
  Rect dstRect = new RectF(x, y, x + tileW, y + tileH);
  canvas.drawBitmap(tileset, srcRect, dstRect, null);
}
Am I missing something completely? Does drawBitmap not actually do any drawing to the target canvas at this stage but only stores a reference to whatever you want to draw (so multiple draw calls to the same object doesn't do anything)?

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

It might help to post your actual code since it depends exactly what you're drawing to, but the basic idea is:
  • Create a bitmap for the canvas to draw onto
  • Create a canvas to hold your bitmap, with new Canvas(bitmap)
Those steps might be unnecessary if you're supplied with a canvas.
  • Do all your drawing calls to the canvas
  • Do any finishing up that's necessary (unlockCanvasAndPost() if you're using a SurfaceView, invalidating a View if you're doing some background drawing and you want it to update with the new bitmap contents, that kind of thing)

If you're seeing drawing happen I'd guess it's a problem with your looping logic though? Try a couple of straight explicit definitions and see if they draw. Also you might be better reusing your Rect objects and using set to change the coords.

netcat
Apr 29, 2008

baka kaba posted:

It might help to post your actual code since it depends exactly what you're drawing to, but the basic idea is:
  • Create a bitmap for the canvas to draw onto
  • Create a canvas to hold your bitmap, with new Canvas(bitmap)
Those steps might be unnecessary if you're supplied with a canvas.
  • Do all your drawing calls to the canvas
  • Do any finishing up that's necessary (unlockCanvasAndPost() if you're using a SurfaceView, invalidating a View if you're doing some background drawing and you want it to update with the new bitmap contents, that kind of thing)

If you're seeing drawing happen I'd guess it's a problem with your looping logic though? Try a couple of straight explicit definitions and see if they draw. Also you might be better reusing your Rect objects and using set to change the coords.

Thanks, but it looks like I'm an idiot. I had a typo (in the real code) when setting the "right" parameter of the dstRect object. So for all tiles > 0 the right parameter was smaller than the left. Man I hate when the rectangles are defined by x1, y1, x2, y2 rather than x, y, w, h. :(

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Good news! Sorta

This is a terrible url that probably won't work

Still requires an initial width and height calculation, but then you can just shift the rect around - there's offsetTo as well

Infomaniac
Jul 3, 2007
Support Cartographers Without Borders
Any prefered libraries to calculate running pace? Do running apps use info from the maps api or use accelerometer data from the device? How is this tested at home- do you just have to go for a jog or can you set up some tests at home?

I'll be researching this today and just thought I'd start here if anyone had some experience with this sort of thing.


Found this: I'll be starting from here I reckon.

It looks like it might be pretty simple using the gps fine location. I'm just going for real-time speed data. Calculating that from the internal sensors looks like a real pita based on some SO questions.

vvvvvvvvv

Infomaniac fucked around with this message at 19:05 on Feb 17, 2014

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Infomaniac posted:

Any prefered libraries to calculate running pace? Do running apps use info from the maps api or use accelerometer data from the device? How is this tested at home- do you just have to go for a jog or can you set up some tests at home?

I'll be researching this today and just thought I'd start here if anyone had some experience with this sort of thing.

There's two separate things to use; the Location APIs (GPS), and the Motion Sensor APIs (Accelerometer/Linear Accelerometer). There's probably someone's library to help out, but it's a question of whether you want aggregate info about your general pace, distance, etc, or whether you're looking for more of a pedometer.

excidium
Oct 24, 2004

Tambahawk Soars
I wrote my first app using PhoneGap and I'm now ready to get it on the store. This is going to be a paid app so I'm now having trouble figuring out the licensing stuff I need to do. Since everything was done in the HTML/JS/CSS, I'm a bit lost now that I have to dive into the Java code. I mean, all I have for my src java file is this:

code:
package com.AngrytacosStudios.AppName;

import android.os.Bundle;
import org.apache.cordova.*;

public class AppName extends CordovaActivity 
{
  
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl());
        //super.loadUrl("file:///android_asset/www/index.html")
    }
}
Reading through the Docs (http://developer.android.com/google/play/licensing/index.html) I can understand bits and pieces of what they want me to do to add LVL checking, but it doesn't seem like a complete picture. Maybe that's just my lack of experience/knowledge but I could use some help if anyone has any tips on where to go from here.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Wow, great OP in this thread. I'm just getting started in Android development and found the info really useful.

One thing I'm curious about, is there any pattern for MVC/MVVM/etc. style application development in Android? I've done stuff in the windows and web worlds where there's nice databinding support so you can build a simple model and bind its values directly to UI elements (i.e. updating an edit box changes the value of a model property automatically). From looking at the Android docs and searching around a bit it doesn't seem like there's anything native in the Android SDK for it. Is there any mature or frequently used libraries for MVC style development in Android?

Doctor w-rw-rw-
Jun 24, 2008

mod sassinator posted:

Wow, great OP in this thread. I'm just getting started in Android development and found the info really useful.

One thing I'm curious about, is there any pattern for MVC/MVVM/etc. style application development in Android? I've done stuff in the windows and web worlds where there's nice databinding support so you can build a simple model and bind its values directly to UI elements (i.e. updating an edit box changes the value of a model property automatically). From looking at the Android docs and searching around a bit it doesn't seem like there's anything native in the Android SDK for it. Is there any mature or frequently used libraries for MVC style development in Android?

Friend of mine wrote this: https://github.com/depoll/bindroid

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Nice, I'll check it out.

I'm also curious what do folks prefer for a development IDE? I've played with the Eclipse-based ADT, IntelliJ-based Android Studio, and normal IntelliJ with Android SDK. I really like the IntelliJ IDE compared to Eclipse--the UI builder seems much nicer in IntelliJ and the IDE doesn't seem as clunky as Eclipse. I wanted to like AS, but the gradle-based system seems like it's way too cutting edge for someone starting out. Simple stuff like adding an external library or unit tests are infuriatingly difficult in AS (and also terribly documented with many blog posts showing bad or outdated ways to do it). I've settled on IntelliJ 13 CE with the Android SDK since it's 99% of AS but with the normal ant-based build system. For anyone that's gone down the path of IntelliJ, do you have any regrets or major issues?

As far as prototyping and quickly iterating on UI designs, are there any better tools than what's built into the major IDEs? I really like IntelliJ's view with the layout XML next to a live updating preview of the design.

Glimm
Jul 27, 2005

Time is only gonna pass you by

mod sassinator posted:

Wow, great OP in this thread. I'm just getting started in Android development and found the info really useful.

Thanks, I've actually been slacking though - a ton of new useful libraries and development techniques have cropped up since my last update. I'm hoping to update the OP again soon, I'm just a lazy rear end in a top hat.

Personally I've been using Android Studio lately. If something is on maven central it really makes pulling in dependencies incredibly easy. If you need any specific help with getting Gradle working or importing a library project that's all code just post in here and we should be able to help you through it (assuming you want to give AS another shot). Before AS though I definitely used IntelliJ and found it a lot nicer than Eclipse to work in.

For prototyping UI designs I typically work straight with the xml and use IntelliJ/Android Studio's live preview. It works really well. Just make sure to use View.isInEditMode() when making custom views to prevent errors/warnings popping up in the preview.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
I'll see how things go with IntelliJ for now--once I understand more about gradle, maven, etc. I might check out AS again.

Some of the libraries mentioned in the OP look really handy, like RoboGuice and AQuery. Are there any other extremely useful, general libraries to check out?

For controls, SlidingMenu looks really nice. Any other widely used and useful controls to check out?

Glimm
Jul 27, 2005

Time is only gonna pass you by

mod sassinator posted:

I'll see how things go with IntelliJ for now--once I understand more about gradle, maven, etc. I might check out AS again.

Some of the libraries mentioned in the OP look really handy, like RoboGuice and AQuery. Are there any other extremely useful, general libraries to check out?

Yeah, this is one reason I need to update the OP. RoboGuice isn't terribly performant, Dagger is probably the DI framework of choice on Android.

I'd also recommend Ion (web requests/image loading) or OkHttp/Retrofit & Picasso(image loading) over AQuery these days. AQuery has a few bugs that can be a pain to work around. I feel like I write better code using the other libraries.


quote:

For controls, SlidingMenu looks really nice. Any other widely used and useful controls to check out?

SlidingMenu is nice but Google provides a NavigationDrawer which is built into the system (well, the support library) and is really preferred as you end up with a control that is more familiar to users.

For checking out other controls DevAppsDirect is a really nice app. It incorporates demos for a large number of 3rd party applications. Some neat ones off the top of my head: Etsy's staggered grid, cardslib (mimic Google's cards style a la G+/Google Now), and Crouton (toast like notifications tied to a particular View instead of just showing up haphazardly).

One other app that is really nice for development is DevDrawer. Add it as a widget and add your package names to it (com.glimm.*) and all apps with that package will be listed there, so you can quickly open them/delete them/clear their data. It'll remember which apps you're working on - so as soon as you install an app that matches it'll show up in the list. Pretty handy.

Glimm fucked around with this message at 02:41 on Feb 22, 2014

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Man, managing jar dependencies is a bit of a nightmare. I'm trying to add the hamcrest library to an android unit test project, but when I do I keep getting this error on build:

Android Dex: [AndroidTests] Unable to execute DX
Android Dex: [AndroidTests] com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description;

It seems like this means there are multiple libraries, but as far as I can tell this is the only one. Anyone else run into this?

Also, am I just doing something wrong or is managing jar dependencies a big nightmare? It seems like I have to fight every library I add to make it work. Really feels like I'm doing something wrong.

zeekner
Jul 14, 2007

mod sassinator posted:

Man, managing jar dependencies is a bit of a nightmare. I'm trying to add the hamcrest library to an android unit test project, but when I do I keep getting this error on build:

Android Dex: [AndroidTests] Unable to execute DX
Android Dex: [AndroidTests] com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description;

It seems like this means there are multiple libraries, but as far as I can tell this is the only one. Anyone else run into this?

Also, am I just doing something wrong or is managing jar dependencies a big nightmare? It seems like I have to fight every library I add to make it work. Really feels like I'm doing something wrong.

You're using the legacy IDEA build config, right? You probably need to set the duplicate JAR reference to Provided.

e: Gradle handles that kind of thing automatically, so whenever you get into that it'll save a lot of trouble.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Yeah the weird thing is as far as I can tell I only have one jar with hamcrest, but I think junit uses it internally too so it might be confusing things. I gave up on trying to use hamcrest for now and will just stick to the asserts provided by the Android SDK.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Starting to feel like I really need to use maven. Looking at how to use Dagger and it seems like manually installing it isn't documented, and is pretty sucky (all kinds of wackiness with configuring a new compiler library and such). Is there any good overview of how to use maven and the android sdk? I've seen a bunch of stack overflow questions that seem to say different things.

To make sure I understand stuff correctly too, maven is basically a replacement build system that also does dependency management (like downloading dependencies from a central repository), right? I.e. if I switch to maven my project needs to switch away from its ant-based build system.

And just to humor me, is gradle yet another build system to consider? Do gradle and maven work together?

Sorry for the basic questions--still pretty new to Android development.

edit: Ah, this SO question has a great breakdown of each system: http://stackoverflow.com/questions/1163173/why-use-gradle-instead-of-ant-or-maven

I really don't like clunky XML-based build systems and like what gradle is trying to achieve. Sounds like I should give gradle a second shot.

mod sassinator fucked around with this message at 07:16 on Feb 22, 2014

zeekner
Jul 14, 2007

mod sassinator posted:

Starting to feel like I really need to use maven. Looking at how to use Dagger and it seems like manually installing it isn't documented, and is pretty sucky (all kinds of wackiness with configuring a new compiler library and such). Is there any good overview of how to use maven and the android sdk? I've seen a bunch of stack overflow questions that seem to say different things.

To make sure I understand stuff correctly too, maven is basically a replacement build system that also does dependency management (like downloading dependencies from a central repository), right? I.e. if I switch to maven my project needs to switch away from its ant-based build system.

And just to humor me, is gradle yet another build system to consider? Do gradle and maven work together?

Sorry for the basic questions--still pretty new to Android development.

edit: Ah, this SO question has a great breakdown of each system: http://stackoverflow.com/questions/1163173/why-use-gradle-instead-of-ant-or-maven

I really don't like clunky XML-based build systems and like what gradle is trying to achieve. Sounds like I should give gradle a second shot.

Yea, gradle is the way to go. Maven support is only through third-party build plugins and it's a bit of a pain to manage. Thankfully gradle does make use of the maven repository, so you still have access to almost everything maven would have.

This site is pretty useful when you need to find dependencies: http://gradleplease.appspot.com/ It'll look up the package name and give you the most recent version.

If you want a quick and dirty way to convert to gradle, you can do it in a few steps:
1. Create a new dummy project in Android Studio, it doesn't matter the package name or anything.
2. Copy these files from the dummy to your project:
gradlew
gradlew.bat
gradle/ (copy the folder and contents, skip .gradle as it's just a temp folder)
gradle.properties (if it exists, it'll probably be empty)
build.gradle
settings.gradle (edit this and replace the dummy folder name)
(AppName)/build.gradle (you'll need to edit this to add any dependencies/signing configs/ect)

Once you've copied the files over, you just need to move the folders for src, assets, res, and the manifest. The standard layout is this:
(AppName)/src/main/java/(com/whatever/yourname)
(AppName)/src/main/assets/
(AppName)/src/main/res/
(AppName)/src/main/AndroidManifest.xml

For tests:
(AppName)/src/instrumentTest/java/

Some conversion guides just use a modified build.gradle that overrides the folder locations to point to the old folder structure, but I figure it's easier in the long run to just move them.

Delete any .iml files and the .idea folder to prevent any IDE issues.

Then just open the project in Android Studio, it'll automatically import and try to build it. One little bug to watch out for: when AS tries to import the project, make sure it's not trying to point to (ProjectFolder)/gradle, and make sure the gradle wrapper option is selected.

If you have JAR files in the libs folder, they'll automatically be included like normal, but it's a good idea to replace them with maven references. Using local copies of android libraries is a little bit of work, try to find a maven version to save you some trouble.

That should leave you with a build, from there you can add a signing configurations to handle release builds.

If you run into any snags, try to compare the config to your dummy project. Also make sure to hit the "Sync Gradle" button when you edit a gradle file. AS will pop up a little reminder at the top of the window.

zeekner fucked around with this message at 09:26 on Feb 22, 2014

Glimm
Jul 27, 2005

Time is only gonna pass you by

FYI I've updated the OP with what I hope is better, more current information. There are a few interesting projects I'd like to talk about and maybe add to the list of libraries but I think this is better than recommending Eclipse/SlideMenu/ActionBarSherlock/RoboGuice like it was before.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Awesome--I'm really impressed with Square's libraries. Those guys really seem to be on top of Android development.

Starting to play with AS again, and now that I realize gradle is the one true way to use it it's not so bad. I just want to check, with the latest version of AS you still have to run your instrument tests through a terminal with the gradlew connectedCheck command right? I tried making a run configuration for tests but it bombs out with a test runner error and all the SO answers seem to indicate running tests is only through the terminal right now.

Doctor w-rw-rw-
Jun 24, 2008

mod sassinator posted:

Awesome--I'm really impressed with Square's libraries. Those guys really seem to be on top of Android development.

I should hope so. Bob Lee, their CTO, previously led core library development on Android at Google.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Cool--with gradle and maven I got the hamcrest library working for tests. A few things that threw me off, if you just search for hamcrest on gradle, please you'll get a reference to some older version that doesn't work with android. You need to find the libary on maven central and after some googling find out you really need to include just a few components of the library in your build.gradle:

code:
dependencies {
    compile 'org.hamcrest:hamcrest-core:1.3'
    compile 'org.hamcrest:hamcrest-library:1.3'
    compile 'org.hamcrest:hamcrest-integration:1.3'
}
This will fail to build because of a duplicate file:

code:
Error: duplicate files during packaging of APK 
        Path in archive: LICENSE.txt   
So you need to add this to the android section of the project's build.gradle:

code:
packagingOptions {
    exclude 'LICENSE.txt'
}
Finally you probably need to run Tools -> Android -> Sync Project with Gradle Files in AS to get the dependency downloaded.

I'm curious to understand the duplicate file issue--what's actually happening that causes the error? It's a little concerning to me that libraries which happen to have duplicate files will completely break your build. Is it a bad library, or just a quirk/issue of how APKs are built?

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
This is dumb, but where do you see the logcat output from a unit test run in IntelliJ? I want to see some stuff being logged during the test run, but when I go to the logcat view after the test run it's not updated. Seems like the logcat view only shows data from actual runs. I have to be missing something obvious--how do you see the logcat from a test run?

edit: Found an option for my test run configuration to clear the logcat before running. Checked this and the logcat is cleared, but there's still nothing being written to it. Wtf, is this a bug of AS?

mod sassinator fucked around with this message at 02:57 on Feb 25, 2014

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

mod sassinator posted:

This is dumb, but where do you see the logcat output from a unit test run in IntelliJ? I want to see some stuff being logged during the test run, but when I go to the logcat view after the test run it's not updated. Seems like the logcat view only shows data from actual runs. I have to be missing something obvious--how do you see the logcat from a test run?

edit: Found an option for my test run configuration to clear the logcat before running. Checked this and the logcat is cleared, but there's still nothing being written to it. Wtf, is this a bug of AS?

Possibly.

You can always just do lolcat from the commandline, which has various benefits/drawbacks.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop
Ok, trying to use AndroidStudio again.

Now I'm having the "exciting" issue where it's throwing a fatal exception in code that doesn't exist in my project, because somehow it cached the very first version on the AVD and absolutely refuses to change it for any reason whatsoever.

uninstalling the APK doesn't do poo poo. I even tried bumping the version number, and the new version number shows up, but it still throws a NPE on a line that's past the end of my file.

The NPE (was) in the boilerplate code where it was binding to a button by ID that I renamed. So somehow it's still running the template code that comes with a new project, but using my layout with different names.

WTF google.

Edit: ... deleting build didn't fix it, wiping the AVD didn't fix it, but running my project in the debugger did, and now when I change code it's reflected in the apk. How bizarre.

Harik fucked around with this message at 07:45 on Feb 26, 2014

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
What's a good, cheap SDK that'll simplify game development? I want to dabble in making awful, lovely-looking Android games but there are just too many options.

On a related note, GameMaker has a sale right now: upgrades from Standard to Professional are $35 instead of $99. This'd let me test games on Android, but I'd have to shell out another $199.99 to purchase the module that lets me compile the finished product so I can release it on the Play Store. Should I upgrade?

Edit: I want to add to the endless sea of blackjack games so I'd only need to work in 2D for now.

IAmKale fucked around with this message at 16:06 on Feb 26, 2014

zeekner
Jul 14, 2007

LibGDX is pretty nice, it's not a pre-built game engine like GameMaker but definitely a pretty nice framework. They set up the project structure such that you can run the same game on Android or directly on the desktop, so you can quickly jump between them.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Any tips on how to add a resource file to a gradle test project (the standard instrumentTest folder)? I can create a res/raw folder but I don't know how a R.raw.file value is generated like in the non-test project. I need the resource ID so I can load it from my test case.

Tunga
May 7, 2004

Grimey Drawer
Looks like there's a getResourcesForApplication(packageName) on PackageManager, I think that will do it.

fritz
Jul 26, 2003

So I find myself in the position of having to support development of an android app, and it looks like I'm going to be expected to run and test the interface myself on an actual device. I would really rather not do this manually, and some googling turned up something called "selendroid". Is this the way to go? I basically need to simulate a metric shitload of swipes and feed them to the app. (this is way outside of my comfort zone, I'm not at all a front end person)

kitten smoothie
Dec 29, 2001

I had never heard of that one before. We use Robotium which looks similar. One of our QA guys has set up a Jenkins slave box on a Mac mini that has half a dozen different phones plugged in, so when you kick off a build it runs the instrumentation tests on every phone simultaneously.

fritz
Jul 26, 2003

kitten smoothie posted:

I had never heard of that one before. We use Robotium which looks similar. One of our QA guys has set up a Jenkins slave box on a Mac mini that has half a dozen different phones plugged in, so when you kick off a build it runs the instrumentation tests on every phone simultaneously.

Cool, I'll check that out too, thanks.

I'm having some trouble even getting going, I'm trying to follow the tutorial here: https://developer.android.com/training/basics/firstapp/index.html and if I try to start a new project in Eclipse, it looks like it's not creating all the right files (such as R.java). I can do an "android create project ... " and get a thing that I can compile and put on the emulator. I'd like to get that project into Eclipse, but I can't figure out the magic to do so.
Maybe it worked? I had to totally blow away my Eclipse project directory but stuff seems to be happening.

fritz fucked around with this message at 03:38 on Mar 1, 2014

zeekner
Jul 14, 2007

fritz posted:

Cool, I'll check that out too, thanks.

I'm having some trouble even getting going, I'm trying to follow the tutorial here: https://developer.android.com/training/basics/firstapp/index.html and if I try to start a new project in Eclipse, it looks like it's not creating all the right files (such as R.java). I can do an "android create project ... " and get a thing that I can compile and put on the emulator. I'd like to get that project into Eclipse, but I can't figure out the magic to do so.
Maybe it worked? I had to totally blow away my Eclipse project directory but stuff seems to be happening.

R.java is autogenerated when the project builds. I always had issues with Eclipse failing to rebuild it automatically, I'd have to clean workspace + rebuild to fix it.

Literally Elvis
Oct 21, 2013

Can someone explain to me

In case anybody's curious, the primary issue after going line-by-line was a TextView.setText was receiving a char, which I thought was fine, and triggered no IDE errors, but was apparently super not fine. :toot:

Literally Elvis fucked around with this message at 10:21 on Mar 1, 2014

fritz
Jul 26, 2003

OK, so I have a very basic thing working going through eclipse and the "android create project" workflow. I got to https://developer.android.com/training/basics/actionbar/index.html however I'm getting errors:
EDIT: I nuked lots of stuff, pointed Eclipse to the "right" directory, re-followed the actionbar stuff and I'm getting a little bit farther.



The homebrew installation has an examples directory, and I went there to try to build some of those to see what would happened. I went to samples/android-19/ui/ActionBarCompat-Styled
and, following the README.txt, ran "./gradlew build". It dl'd a bunch of things, but doesn't build. Here's what happens:
code:
$ ./gradlew build

FAILURE: Build failed with an exception.

* Where:
Build file '/usr/local/var/lib/android-sdk/samples/android-19/ui/ActionBarCompat-Styled/ActionBarCompat-StyledSample/build.gradle' line: 14

* What went wrong:
A problem occurred evaluating project ':ActionBarCompat-StyledSample'.
> Could not create plugin of type 'AppPlugin'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.154 secs
the stack trace is:
code:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':ActionBarCompat-StyledSample'.
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:132)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
	at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
	at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:468)
	at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:76)
	at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
	at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
	at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
	at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
	at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
	at org.gradle.launcher.Main.doAction(Main.java:46)
	at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
	at org.gradle.launcher.Main.main(Main.java:37)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
	at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'AppPlugin'.
	at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:61)
	at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:103)
	at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)
	at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)
	at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
	at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
	at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
	at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
	at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:39)
	at org.gradle.api.Project$apply.call(Unknown Source)
	at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
	at org.gradle.api.Script$apply.callCurrent(Unknown Source)
	at build_4c65ui1crr56pcqbm3ojrhkka9.run(/usr/local/var/lib/android-sdk/samples/android-19/ui/ActionBarCompat-Styled/ActionBarCompat-StyledSample/build.gradle:14)
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
	... 33 more
Caused by: java.lang.NoClassDefFoundError: org/gradle/api/artifacts/result/ResolvedComponentResult
	at com.android.build.gradle.AppPlugin.$getStaticMetaClass(AppPlugin.groovy)
	at com.android.build.gradle.BasePlugin.<init>(BasePlugin.groovy:1756)
	at com.android.build.gradle.AppPlugin.<init>(AppPlugin.groovy:73)
	at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62)
	at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:59)
	... 46 more
Caused by: java.lang.ClassNotFoundException: org.gradle.api.artifacts.result.ResolvedComponentResult
	... 51 more
-info gives me:
code:
Starting Build
Starting file lock listener thread.
Settings evaluated using settings file '/usr/local/var/lib/android-sdk/samples/android-19/ui/ActionBarCompat-Styled/settings.gradle'.
Projects loaded. Root project using build file '/usr/local/var/lib/android-sdk/samples/android-19/ui/ActionBarCompat-Styled/build.gradle'.
Included projects: [root project 'ActionBarCompat-Styled', project ':ActionBarCompat-StyledSample']
Evaluating root project 'ActionBarCompat-Styled' using build file '/usr/local/var/lib/android-sdk/samples/android-19/ui/ActionBarCompat-Styled/build.gradle'.
Evaluating project ':ActionBarCompat-StyledSample' using build file '/usr/local/var/lib/android-sdk/samples/android-19/ui/ActionBarCompat-Styled/ActionBarCompat-StyledSample/build.gradle'.

FAILURE: Build failed with an exception.
-debug has a lot of stuff but nothing seems to go wrong until that exception from the stack trace.


EDIT: line 14 is:
code:
apply plugin: 'android'
It looks like having two copies of the SDK meant that when I thought I had installed everything and more, it was only in one part. I've installed all the stuff in the eclipse-made copy of the SDK, but can't build there either. (same errors)

fritz fucked around with this message at 02:48 on Mar 3, 2014

Glimm
Jul 27, 2005

Time is only gonna pass you by

fritz posted:

Eclipse/Gradle question?

I'm not sure the Gradle build system functions with Eclipse at the moment. Maybe try Android Studio?

Speaking of! 0.5.0 is out now:

http://tools.android.com/recent/androidstudio050released
http://tools.android.com/tech-docs/new-build-system

woop woop

Glimm fucked around with this message at 00:48 on Mar 7, 2014

Adbot
ADBOT LOVES YOU

Infomaniac
Jul 3, 2007
Support Cartographers Without Borders
Poking around with the Facebook sdk has lead me into new realms of insight and frustration. Implementing graph calls led me to write some methods to populate views in ways that I eventually discovered were already provided through the facebook classes.

It took some fiddling and detective work to work out that the Facebook classes are useful and powerful, but somewhat poorly or unintuitively named. The api documentation is not great in my opinion.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply