Office Hours — Today, May 26

Tuesday, May 24

May 26
8:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
9:10 AM
Joshua C.
has entered the room
Mark M.
hello, Joshua
how can I help you today?
Joshua C.
Good morning from the west coast. :)
Mark M.
yeesh
and I thought *I* was an early riser
Joshua C.
Well, everything was working well... and all of the a sudden... R (as in the resource object) "cannot be resolved."
9:15 AM
Mark M.
either a resource or a manifest is malformed, preventing aapt from generating the R class
Joshua C.
Well, I've been working on this program fairly obsessively for weeks now... and I made it a point to get up to ask you this puzzler. :)
Mark M.
you should be getting other build errors that would indicate the source of the problem
what IDE are you using?
Joshua C.
android studio
newest version.
Mark M.
yes, you definitely should be getting some other build errors first
Joshua C.
This problem started when I tried to use the "add" feature... to add a "SettingsActivity".
Mark M.
either that, or you have an import for the wrong R in that Java class
Joshua C.
Then I deleted the settings activity and now this problem is persisting... the imports didn't change at all, just all of a sudden they wouldn't resolve.
I'm looking for more errors... it's being slow.
"Gradle Build Running"
I've been making very good progress, really...
I just noticed one thing that might be the problem, actually... so, I split my code into two packages.. to separate the layout part and the program I'm implementing with the layout...
9:20 AM
Mark M.
at most, one of those Java packages will be the package name in your manifest
Joshua C.
So I have "com.codesolutions.onehandkeyboard" with two classes in it.
Mark M.
in any other Java package, you would need to import the R class
Joshua C.
And I have com.codesolutions.pathlayout
The package name in the manifest it seems had been changed by android studio to a "com.android.example" one... I've changed it to com.codesolutions.onehandkeyboard and I'll know in a sec if that did anything.
Right now, this problem is happening in BOTH packages.
Mark M.
the application ID defined in Gradle does not matter; the package attribute in the <manifest> element is what matters
Joshua C.
Currently this is the top of my AndroidManifest.xml file:
View paste
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codesolutions.onehandkeyboard">
Mark M.
so, your Java classes in com.codesolutions.onehandkeyboard do not need an import statement for com.codesolutions.onehandkeyboard.R
however, your Java classes in com.codesolutions.pathlayout would need an import statement for com.codesolutions.onehandkeyboard.R
9:25 AM
Joshua C.
Right, and they had one... It worked for days like this, after I split it into the two packages.
It was something that android studio did that broke it... this build is taking forever
It still says building.
When I first open the project (after restart or a reboot), it opens like everything is fine... and then only when I try to build does it start giving me this problem...
in the pathlayout package, I do have that import statement, but even in the import statement it says R can't be resolved.
import com.codesolutions.onehandkeyboard.R;
Mark M.
if the build is still going on, that's not surprising
once the build is over, if that persists, that means that the R class is not being generated, and we're back to trying to find the resource file or manifest entry that is causing that
Joshua C.
Okay, yes, still building... oh, another change I made was changing the minSdk.
13 is a reasonable minSdk, no?
That covers most of the devices out there?
Mark M.
well, there are roughly zero devices running API Level 13 or 14
so I'd go with a minSdkVersion of 15, instead of 13
Joshua C.
Okay... it had been set to 1 initially it seems.
9:30 AM
Joshua C.
View paste
Also, while that is building... I suspect you don't know the answer to this very specific and succinct question I've posted here on stackoverflow:
http://stackoverflow.com/questions/37426482/find-the-point-at-which-two-paths-cross-in-android
My program very heavily uses this Path class.
Mark M.
I have never used Path, sorry
Joshua C.
Perhaps you could give my question a bump?
The documentation for that class is frustratingly sparse.
Mark M.
if you mean an upvote, I have now done that
the documentation for lots of Android is frustratingly sparse
IOW, welcome to my life
Joshua C.
View paste
Great, that is exactly what I wanted, thank you.  Hopefully that helps.

Yes, indeed... poor docs.
IOW?
Mark M.
"in other words"
Joshua C.
Ah.
This build has taken over 20 minutes...
View paste
6:08:46 AM Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
Ryan K.
has entered the room
9:35 AM
Mark M.
Joshua: let me take a question from Ryan while your build chugs along
Ryan: hi! how can I help you today?
Joshua C.
Of course, thank you.
Ryan K.
I have met a question about Android Studio,
Project works well on Eclipse
but after I import it to Android Studio
Something strange happened!Installation failed since the APK was either not singed,or signed incorrectly.
Mark M.
what are you doing that is resulting in that message?
9:40 AM
Ryan K.
the config is right,I have searched a lot about this issue,but I cannot find a solution
Mark M.
what are you doing that is resulting in that message?
Ryan K.
I just run and try to install the programe
Mark M.
do you mean that you are just clicking the "run" icon in Android Studio?
or do you mean something else?
Ryan K.
yes
this issue is same to mine
Mark M.
try creating a new project, through the Android Studio new-project wizard
then, try running that project
if that runs, then the problem is tied to the build.gradle file of your imported project, where somehow you are changing up how the debug build type is getting its signing information
if that project does not run, then something more generally is wrong, such as not having a debug keystore (and one not being built automatically for some reason)
9:45 AM
Mark M.
you might also confirm that you are indeed building the debug build variant, in the Build Variants tool, docked by default on the left of the Android Studio window
Ryan K.
ok,thank you,I will try.
Mark M.
let me swing back to Joshua for a bit, and I will return to you before the chat ends
Joshua: anything more on your end?
Joshua C.
View paste
Well, though it never seemed to stop building, I did finally get these errors in the gradle console:
My browser crashed it seemed.
android studio is hung now and won't let me copy the errors...
but they are all "Exception in thread "png-cruncher-##"... and there are lots of them, with various numbers.
RuntimeException: timeout
Mark M.
sounds like there is a problem with some of your drawable resources
Joshua C.
I'm trying to force quit Android now as it's halted.
I have absolutely no drawable resources in my app!
Mark M.
sure you do
if nothing else, you have a launcher icon
if you ever get a build going again, look at the paths of what png-cruncher is choking on
Joshua C.
Oh yes, I do, the default one.
9:50 AM
Joshua C.
Okay, restarting Android Studio now.
Mark M.
if they point to drawables in your project, check them out and see if they have been corrupted (e.g., you cannot open them in a regular image viewer on your development machine)
if either of you have further questions, go right ahead
Joshua C.
So far I can open all the various sizes of the little android alien icon.
I am attempting to build again... hopefully will have more specific errors in a few minutes.
Oh... build successful.
Mark M.
meaning your R problem is now gone?
Joshua C.
Trying to run now... we'll see.
But it seems that way.
Strange...
9:55 AM
Joshua C.
Wow, and it runs.
Mark M.
Ryan: do you have another question?
10:00 AM
Joshua C.
That mess started when I tried to add a Preferences button to my app, and android threw a whole lot of junk in there as a "SettingsActivity"... it's PreferencesFragment I want though, no?
Ryan K.
Do you have any plan to write something about RxJava?
Mark M.
well, you will probably show the preferences via a PreferenceFragment
but whether that is wrapped in a dedicated activity or not would depend upon your app
Ryan: not in the near future, sorry
and that's a wrap for today's chat
the transcript will be posted to http://commonsware.com/office-hours/ shortly
the next chat is scheduled for 7:30pm US Eastern on Saturday
have a pleasant day!
Joshua C.
Okay, then.
Joshua C.
has left the room
Ryan K.
has left the room
Mark M.
turned off guest access

Tuesday, May 24

 

Office Hours

People in this transcript

  • Joshua Chambers
  • Mark Murphy
  • Ryan King